You are here

function command_buttons_entity_info in Command Buttons 7

Impliments hook_crud_hook_entity_info().

File

./command_buttons.module, line 299

Code

function command_buttons_entity_info() {
  $return = array(
    'command_button' => array(
      'label' => t('Command Button'),
      'entity class' => 'Entity',
      'controller class' => 'ButtonController',
      'module' => 'command_buttons',
      'base table' => 'command_buttons',
      'fieldable' => TRUE,
      'exportable' => TRUE,
      'entity keys' => array(
        'id' => 'bid',
        'name' => 'name',
        'bundle' => 'bundle',
        'label' => 'title',
      ),
      'view callback' => 'entity_metadata_view_single',
      'creation callback' => 'command_buttons_create',
      'access callback' => 'command_buttons_access',
      'save callback' => 'command_buttons_save',
      'bundles' => array(
        'button' => array(
          'label' => t('Command Button'),
          'admin' => array(
            'path' => 'admin/structure/command-buttons/manage/%command_buttons_type',
            'bundle argument' => 4,
            'real path' => 'admin/structure/command-buttons/manage/button',
            'access arguments' => array(
              'administer command buttons',
            ),
          ),
        ),
        'node_add' => array(
          'label' => t('Node Creation Button'),
          'admin' => array(
            'path' => 'admin/structure/command-buttons/manage/%command_buttons_type',
            'bundle argument' => 4,
            'real path' => 'admin/structure/command-buttons/manage/node-add',
            'access arguments' => array(
              'administer command buttons',
            ),
          ),
        ),
      ),
      'view modes' => array(
        'full' => array(
          'label' => t('Full'),
          'custom settings' => FALSE,
        ),
      ),
    ),
  );

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