You are here

function multifield_entity_info in Multifield 7.2

Same name and namespace in other branches
  1. 7 multifield.module \multifield_entity_info()

Implements hook_entity_info().

File

./multifield.module, line 99

Code

function multifield_entity_info() {
  $info['multifield'] = array(
    'label' => t('Multifield'),
    'controller class' => 'MultifieldEntityController',
    'base table' => 'multifield',
    'fieldable' => TRUE,
    // Mark this as a configuration entity type to prevent other modules from
    // assuming they can do stuff with this entity type.
    'configuration' => TRUE,
    'bundle keys' => array(
      'bundle' => 'machine_name',
    ),
    'entity keys' => array(
      'id' => 'id',
      'bundle' => 'type',
    ),
  );

  // Bundles must provide a human readable name so we can create help and error
  // messages, and the path to attach Field admin pages to.
  foreach (multifield_load_all() as $machine_name => $multifield) {
    $info['multifield']['bundles'][$machine_name] = array(
      'label' => $multifield->label,
      'admin' => array(
        'path' => 'admin/structure/multifield/manage/%multifield',
        'real path' => 'admin/structure/multifield/manage/' . $machine_name,
        'bundle argument' => 4,
        'access arguments' => array(
          'administer multifield',
        ),
      ),
    );
  }
  return $info;
}