You are here

function boxes_entity_info in Boxes 7.2

Implements hook_entity_info().

File

./boxes.module, line 9

Code

function boxes_entity_info() {
  $return = array(
    'box' => array(
      'label' => t('Block'),
      'entity class' => 'Box',
      'controller class' => 'BoxEntityAPIController',
      'base table' => 'box',
      'fieldable' => TRUE,
      'entity keys' => array(
        'id' => 'bid',
        'bundle' => 'type',
        'label' => 'title',
        'name' => 'delta',
      ),
      'bundles' => array(),
      'bundle keys' => array(
        'bundle' => 'type',
      ),
      'label callback' => 'entity_class_label',
      'uri callback' => 'entity_class_uri',
      'access callback' => 'boxes_access',
      'module' => 'boxes',
      'metadata controller class' => 'BoxMetadataController',
      '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,
            ),
          ),
        ),
      ),
    ),
  );
  foreach (boxes_get_types() as $type) {
    if (!empty($type)) {
      $return['box']['bundles'][$type->type] = array(
        'label' => $type
          ->getLabel(),
        'description' => $type
          ->getDescription(),
        'admin' => array(
          'path' => 'admin/structure/block-types/manage/%boxes_type',
          'real path' => 'admin/structure/block-types/manage/' . $type
            ->buildURL(),
          'bundle argument' => 4,
          'access arguments' => array(
            'administer box types',
          ),
        ),
      );
    }
  }
  return $return;
}