You are here

function fieldable_panels_panes_entity_info in Fieldable Panels Panes (FPP) 7

Implements hook_entity_info().

File

./fieldable_panels_panes.module, line 14
Maintains an entity that appears as panel pane content.

Code

function fieldable_panels_panes_entity_info() {
  $info = array();
  ctools_include('export');
  $bundles = array();
  foreach (ctools_export_crud_load_all('fieldable_panels_pane_type') as $type) {
    $bundles[$type->name] = array(
      'label' => $type->title,
      'description' => $type->description,
      'admin' => array(
        'path' => 'admin/structure/fieldable-panels-panes/%fieldable_panels_pane_type',
        'bundle argument' => 3,
        'real path' => 'admin/structure/fieldable-panels-panes/' . $type->name,
        'access arguments' => array(
          'administer fieldable panels panes',
        ),
      ),
    );
  }
  $info['fieldable_panels_pane'] = array(
    'label' => t('Fieldable panel pane'),
    'controller class' => 'PanelsPaneController',
    'base table' => 'fieldable_panels_panes',
    'revision table' => 'fieldable_panels_panes_revision',
    'fieldable' => TRUE,
    'uuid' => TRUE,
    'entity keys' => array(
      'id' => 'fpid',
      'revision' => 'vid',
      'bundle' => 'bundle',
      'label' => 'title',
      // This key is required for proper integration with Title module.
      'language' => 'language',
      'uuid' => 'uuid',
      'revision uuid' => 'vuuid',
    ),
    'bundles' => $bundles,
    'bundle keys' => array(
      'bundle' => 'name',
    ),
    'label callback' => 'fieldable_panels_panes_entity_label_callback',
    'uri callback' => 'fieldable_panels_panes_entity_uri_callback',
    'view modes' => array(
      // @todo Should support view modes.
      'full' => array(
        'label' => t('Full'),
        'custom settings' => FALSE,
      ),
      'preview' => array(
        'label' => t('Preview'),
        'custom settings' => FALSE,
      ),
    ),
    'inline entity form' => array(
      'controller' => 'FieldablePanelsPaneInlineEntityFormController',
    ),
    // Entity API module callbacks.
    'view callback' => 'entity_metadata_view_single',
    'creation callback' => 'fieldable_panels_panes_create',
    'access callback' => 'fieldable_panels_panes_access',
    'save callback' => 'fieldable_panels_panes_save',
    'deletion callback' => 'fieldable_panels_panes_delete',
    // Entity translation support.
    'translation' => array(
      'entity_translation' => array(
        'class' => 'EntityTranslationFieldablePanelsPaneHandler',
        'base path' => 'admin/structure/fieldable-panels-panes/view/%fieldable_panels_panes',
        'edit path' => 'admin/structure/fieldable-panels-panes/view/%fieldable_panels_panes/edit',
        'path wildcard' => '%fieldable_panels_panes',
      ),
    ),
    // Title module support.
    'field replacement' => array(
      'title' => array(
        'field' => array(
          'type' => 'text',
          'cardinality' => 1,
          'translatable' => TRUE,
        ),
        'instance' => array(
          'label' => t('Title'),
          'description' => t('A field replacing fieldable panel pane title.'),
          'required' => FALSE,
          'settings' => array(
            'text_processing' => 0,
          ),
          'widget' => array(
            'weight' => -10,
          ),
        ),
      ),
    ),
    // Disable support for the Redirect module.
    'redirect' => FALSE,
  );

  // Optional support for the entitycache module.
  if (module_exists('entitycache')) {
    $info['fieldable_panels_pane']['field cache'] = FALSE;
    $info['fieldable_panels_pane']['entity cache'] = TRUE;
  }
  return $info;
}