function views_rules_list_iterators in Views Rules 7
Lists options for all view displays for use as rules iterators.
Each display is identified by the view name, followed by a colon (':'), and then the display name.
3 calls to views_rules_list_iterators()
- ViewsRulesFrameworkTestCase::testListIterators in tests/
views_rules.test - Tests listing rule iterator view displays.
- views_rules_add_view_loop in rules/
views_rules.rules_admin.inc - Provides a variant of rules_ui_add_element() to present a view display selector for creating a view loop.
- views_rules_collect_rows_form_alter in rules/
views_rules.ui.inc - Alters action form for views_rules_collect_rows().
1 string reference to 'views_rules_list_iterators'
- views_rules_rules_action_info in ./
views_rules.rules.inc - Implements hook_rules_action_info().
File
- ./
views_rules.module, line 72 - Views & Rules deep-level integration.
Code
function views_rules_list_iterators($grouped = TRUE) {
$applicable_displays = views_get_applicable_views('rules iterator');
$options = array();
foreach ($applicable_displays as $view_display) {
/** @var $view view */
list($view, $display_name) = $view_display;
// Validate display.
if (!$view
->validate()) {
continue;
}
// Check user access.
if (!$view
->access($display_name)) {
continue;
}
// Build option.
$view_label = $view
->get_human_name();
if (empty($view_label)) {
$view_label = $view->name;
}
$display_label = $view->display_handler->display->display_title;
// Add display as option.
$display_id = $view->name . ':' . $display_name;
if ($grouped) {
$options[$view_label][$display_id] = $display_label;
}
else {
$options[$display_id] = t('@view_title: @display_title', array(
'@view_title' => $view_label,
'@display_title' => $display_label,
));
}
}
return $options;
}