function paragraphs_entity_info in Paragraphs 7
Implements hook_entity_info().
File
- ./
paragraphs.module, line 93 - Paragraphs hooks and common functions.
Code
function paragraphs_entity_info() {
$return['paragraphs_item'] = array(
'label' => t('Paragraphs item'),
'label callback' => 'entity_class_label',
'uri callback' => 'entity_class_uri',
'entity class' => 'ParagraphsItemEntity',
'controller class' => 'EntityAPIController',
'base table' => 'paragraphs_item',
'revision table' => 'paragraphs_item_revision',
'fieldable' => TRUE,
// For integration with Redirect module.
// @see http://drupal.org/node/1263884
'redirect' => FALSE,
'entity keys' => array(
'id' => 'item_id',
'revision' => 'revision_id',
'bundle' => 'bundle',
'field_name' => 'field_name',
'language' => 'langcode',
),
'module' => 'paragraphs',
'view modes' => array(
'full' => array(
'label' => t('Full content'),
'custom settings' => FALSE,
),
'paragraphs_editor_preview' => array(
'label' => t('Paragraphs Editor Preview'),
'custom settings' => TRUE,
),
),
'bundle keys' => array(
'bundle' => 'bundle',
),
'access callback' => 'paragraphs_item_access',
'metadata controller class' => 'ParagraphsItemMetadataController',
);
$bundles = paragraphs_bundle_load();
// Add info about the bundles. We do not use field_info_fields() but directly
// use field_read_fields() as field_info_fields() requires built entity info
// to work.
foreach ($bundles as $machine_name => $bundle) {
$return['paragraphs_item']['bundles'][$bundle->bundle] = array(
'label' => $bundle->name,
'admin' => array(
'path' => 'admin/structure/paragraphs/%paragraphs_bundle',
'real path' => 'admin/structure/paragraphs/' . strtr($machine_name, array(
'_' => '-',
)),
'bundle argument' => 3,
'access arguments' => array(
'administer paragraphs bundles',
),
),
);
}
if (module_exists('entitycache')) {
$return['paragraphs_item']['field cache'] = FALSE;
$return['paragraphs_item']['entity cache'] = TRUE;
}
return $return;
}