function ctools_argument_entity_id_get_children

1 call to ctools_argument_entity_id_get_children()
ctools_argument_entity_id_get_child in plugins/arguments/entity_id.inc
1 string reference to 'ctools_argument_entity_id_get_children'
entity_id.inc in plugins/arguments/entity_id.inc
Plugin to provide an argument handler for all entity ids.

File

plugins/arguments/entity_id.inc, line 29

Code

function ctools_argument_entity_id_get_children($original_plugin, $parent) {
    $entities = entity_get_info();
    $plugins = array();
    foreach ($entities as $entity_type => $entity) {
        $plugin = $original_plugin;
        $plugin['title'] = t('@entity: ID', array(
            '@entity' => $entity['label'],
        ));
        $plugin['keyword'] = $entity_type;
        $plugin['description'] = t('Creates @entity context from an ID argument.', array(
            '@entity' => $entity_type,
        ));
        $plugin['name'] = $parent . ':' . $entity_type;
        $plugin_id = $parent . ':' . $entity_type;
        drupal_alter('ctools_entity_context', $plugin, $entity, $plugin_id);
        $plugins[$plugin_id] = $plugin;
    }
    drupal_alter('ctools_entity_contexts', $plugins);
    return $plugins;
}