You are here

function bean_entity_info in Bean (for Drupal 7) 7

Implements hook_entity_info().

1 call to bean_entity_info()
PanelizerEntityBean::hook_page_alter in plugins/entity/PanelizerEntityBean.class.php
Implements a delegated hook_page_alter.

File

./bean.module, line 11
Block Entity

Code

function bean_entity_info() {
  $return = array(
    'bean' => array(
      'label' => t('Block'),
      'entity class' => 'Bean',
      'controller class' => 'BeanEntityAPIController',
      // This class provides integration with the Inline entity form module.
      'inline entity form' => array(
        'controller' => 'BeanInlineEntityFormController',
      ),
      'base table' => 'bean',
      'revision table' => 'bean_revision',
      'fieldable' => TRUE,
      'entity keys' => array(
        'id' => 'bid',
        'bundle' => 'type',
        'label' => 'label',
        'name' => 'delta',
        'revision' => 'vid',
        'default revision' => 'default_revision',
      ),
      'bundles' => array(),
      'bundle keys' => array(
        'bundle' => 'type',
      ),
      'label callback' => 'entity_class_label',
      'uri callback' => 'entity_class_uri',
      'access callback' => 'bean_access',
      'view callback' => 'bean_view_callback',
      'module' => 'bean',
      'metadata controller class' => 'BeanMetadataController',
      'view modes' => array(
        'default' => array(
          'label' => t('Default'),
          'custom settings' => FALSE,
        ),
      ),
      'field replacement' => array(
        'title' => array(
          'field' => array(
            'type' => 'text',
            'cardinality' => 1,
            'translatable' => TRUE,
          ),
          'instance' => array(
            'label' => t('Title'),
            'description' => t('The Title of the block.'),
            'required' => FALSE,
            'settings' => array(
              'text_processing' => 0,
            ),
            'widget' => array(
              'weight' => -5,
            ),
          ),
        ),
      ),
      'translation' => array(
        'entity_translation' => array(
          'class' => 'EntityTranslationBeanHandler',
          'base path' => 'block/%bean_delta',
          'path wildcard' => '%bean_delta',
          'path schemes' => array(
            'default' => array(),
          ),
        ),
      ),
      // @see devel_contrib.module
      'devel contrib generator class' => 'DevelContribGeneratorDefault',
    ),
  );
  foreach (bean_get_types() as $type) {
    if (!empty($type)) {
      $return['bean']['bundles'][$type->type] = array(
        'label' => $type
          ->getLabel(),
        'description' => $type
          ->getDescription(),
        'admin' => array(
          'path' => 'admin/structure/block-types/manage/%bean_type',
          'real path' => 'admin/structure/block-types/manage/' . $type
            ->buildURL(),
          'bundle argument' => 4,
          'access arguments' => array(
            'administer bean types',
          ),
        ),
      );
    }
  }
  return $return;
}