<?php

/**
 * @file
 * Install tasks for flexslider_example
 *
 * @author Mathew Winstone <mwinstone@coldfrontlabs.ca>
 */

/**
 * Implements hook_uninstall().
 */
function flexslider_example_uninstall() {
  // Collect all the example nodes and delete them since core/features won't do
  // this for us
  // @see [#1840288]
  
  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'flexslider_example');
  
  $results = $query->execute();
  
  // Ensure we have some nodes
  if (!empty($results['node'])) {
    $nids = array_keys($results['node']);
    node_delete_multiple($nids);
  }
}



/**
 * Implements hook_update_N().
 *
 * Checks for the Context module. Disables if not present.
 */
function flexslider_example_update_7001(&$sandbox) {
  if (!module_exists('context')) {
    module_disable(array('flexslider_example'));
      drupal_set_message(t('FlexSlider Example has been disabled as it now requires the !context module which is not currently available. Please download and enable the !context module and re-enable the FlexSlider Example module', array('!context' => l('Context', 'http://drupal.org/project/context'))), 'warning');
  }
}

