You are here

function _simpleads_get_views_list in SimpleAds 7.2

Get all available Views and make sure a display has style plugin = SimpleAds.

2 calls to _simpleads_get_views_list()
simpleads_block_configure in includes/blocks.inc
Implements hook_block_configure().
simpleads_new_block_form in ./simpleads.admin.inc
New advertisement block form.

File

includes/helper.inc, line 131
Helper functions.

Code

function _simpleads_get_views_list() {
  $result = array();
  $views = views_get_all_views();
  foreach ($views as $view) {
    $style_found = FALSE;
    foreach ($view->display as $display_id => $display) {
      if (isset($display->display_options['style_plugin']) && $display->display_options['style_plugin'] == 'simpleads') {
        $style_found = TRUE;
      }
    }
    if ($style_found) {
      $result[$view->name] = check_plain($view->human_name);
    }
  }
  if (count($result) == 0) {
    drupal_set_message(t('Please create a View that contains a SimpleAds plugin style.'), 'warning');
  }
  drupal_alter('simpleads_views_list', $result);
  return $result;
}