You are here

function entity_block_menu in Entity Blocks 7

Implements hook_menu().

File

./entity_block.module, line 55
Display entities (via view modes) as fieldable blocks.

Code

function entity_block_menu() {
  $items = array();

  // Manage path.
  $items['admin/structure/entity-blocks'] = array(
    'title' => 'Entity blocks',
    'description' => t('Administer entity blocks.'),
    'page callback' => 'entity_block_list',
    'access arguments' => array(
      'adminiter entity blocks',
    ),
  );
  $items['admin/structure/entity-blocks/manage/list'] = array(
    'title' => 'List',
    'type' => MENU_DEFAULT_LOCAL_TASK,
  );

  // Add path.
  $items['admin/structure/entity-blocks/manage/add'] = array(
    'title' => 'Add entity block',
    'page callback' => 'entity_block_add',
    'access arguments' => array(
      'administer entity blocks',
    ),
    'type' => MENU_LOCAL_ACTION,
  );

  // Action link for themes.
  $default_theme = variable_get('theme_default', 'bartik');
  foreach (list_themes() as $key => $theme) {
    if ($key != $default_theme) {
      $items['admin/structure/block/list/' . $key . '/add-entity-block'] = array(
        'title' => 'Add entity block',
        'description' => 'Add a new entity block.',
        'page callback' => 'entity_block_add',
        'access arguments' => array(
          'administer entity blocks',
        ),
        'type' => MENU_LOCAL_ACTION,
      );
    }
  }

  // Edit path.
  $items['admin/structure/entity-blocks/%entity_block/edit'] = array(
    'title' => 'Edit',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'entity_block_form',
      3,
    ),
    'access arguments' => array(
      'administer entity blocks',
    ),
  );

  // Autocomplete path.
  $items['entityreference/autocomplete/entity_block/%/%'] = array(
    'title' => 'Entity Block Autocomplete',
    'page callback' => 'entity_block_autocomplete_callback',
    'page arguments' => array(
      3,
      4,
    ),
    'access arguments' => array(
      'administer entity blocks',
    ),
    'type' => MENU_CALLBACK,
  );
  return $items;
}