function rules_entity_action_access

Entity actions access callback.

Returns TRUE if at least one type is available for configuring the action.

Related topics

1 string reference to 'rules_entity_action_access'
rules_entity_action_info in modules/entity.rules.inc
Implements hook_rules_action_info() on behalf of the entity module.

File

modules/entity.rules.inc, line 310

Code

function rules_entity_action_access($type, $name) {
    if ($name == 'entity_fetch' || $name == 'entity_create' || $name == 'entity_query') {
        $types = array_keys(rules_entity_action_type_options($name));
        $op = $name == 'entity_create' ? 'create' : 'view';
    }
    elseif ($name == 'entity_save' || $name == 'entity_delete') {
        $types = array_keys(entity_get_info());
        $op = $name == 'entity_save' ? 'save' : 'delete';
    }
    foreach ($types as $key => $type) {
        if (!entity_access($op, $type)) {
            unset($types[$key]);
        }
    }
    return !empty($types);
}