function entity_type_supports in Entity API 7
Determines whether for the given entity type a given operation is available.
Parameters
$entity_type: The type of the entity.
$op: One of 'create', 'view', 'save', 'delete', 'revision delete', 'access' or 'form'.
Return value
bool Whether the entity type supports the given operation.
4 calls to entity_type_supports()
- EntityDrupalWrapper::save in includes/
entity.wrapper.inc - Permanently save the wrapped entity.
- entity_entity_view_content_type_content_types in ctools/
content_types/ entity_view.inc - Implements hook_PLUGIN_content_type_content_types().
- entity_property_values_create_entity in includes/
entity.property.inc - Creates the entity object for an array of given property values.
- entity_views_data in views/
entity.views.inc - Implements hook_views_data().
File
- ./
entity.module, line 61
Code
function entity_type_supports($entity_type, $op) {
$info = entity_get_info($entity_type);
$keys = array(
'view' => 'view callback',
'create' => 'creation callback',
'delete' => 'deletion callback',
'revision delete' => 'revision deletion callback',
'save' => 'save callback',
'access' => 'access callback',
'form' => 'form callback',
);
if (isset($info[$keys[$op]])) {
return TRUE;
}
if ($op == 'revision delete') {
return in_array('EntityAPIControllerInterface', class_implements($info['controller class']));
}
if ($op == 'form') {
return (bool) entity_ui_controller($entity_type);
}
if ($op != 'access') {
return in_array('EntityAPIControllerInterface', class_implements($info['controller class']));
}
return FALSE;
}