You are here

function _views_bulk_operations_rules_get_entity_type in Views Bulk Operations (VBO) 7.3

Helper function that loads and builds (but doesn't execute) the specified view, then determines the entity type on which the VBO field operates.

Parameters

$view_target: A string in the format "$view_name|$display_name".

Return value

The entity type on which the VBO field operates.

1 call to _views_bulk_operations_rules_get_entity_type()
views_bulk_operations_action_load_list_info_alter in ./views_bulk_operations.rules.inc
Info alteration callback for the 'views_bulk_operations_action_views_load_list' action.

File

./views_bulk_operations.rules.inc, line 241
Views Bulk Operations conditions and actions for Rules.

Code

function _views_bulk_operations_rules_get_entity_type($view_target) {
  $entity_types =& drupal_static(__FUNCTION__);
  if (!isset($entity_types[$view_target])) {
    $views_settings = explode('|', $view_target);
    if ($view = views_get_view($views_settings[0])) {
      $view
        ->set_display($views_settings[1]);
      $view
        ->build();
      $vbo = _views_bulk_operations_get_field($view);
    }
    $entity_type = !empty($vbo) ? $vbo
      ->get_entity_type() : '';
    $entity_types[$view_target] = $entity_type;
  }
  return $entity_types[$view_target];
}