You are here

function command_buttons_entities_page in Command Buttons 7

List all bundles and administrative options for command buttons.

1 string reference to 'command_buttons_entities_page'
command_buttons_menu in ./command_buttons.module
Implements hook_menu().

File

./command_buttons.admin.inc, line 7

Code

function command_buttons_entities_page() {
  $entity_info = entity_get_info('command_button');
  $header = array(
    t('Name'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $rows = array();
  foreach ($entity_info['bundles'] as $bundle => $info) {
    $type_url_str = str_replace('_', '-', $bundle);
    $row = array();
    $label = check_plain($info['label']);
    $label .= ' <small>' . t('(Machine name: @type)', array(
      '@type' => $bundle,
    )) . '</small>';
    $row[] = $label;
    $operations = array();
    $operations['list'] = array(
      'title' => t('list'),
      'href' => 'admin/structure/command-buttons/manage/' . $type_url_str,
    );
    $operations['add'] = array(
      'title' => t('add'),
      'href' => 'admin/structure/command-buttons/manage/' . $type_url_str . '/add',
    );
    $operations['fields'] = array(
      'title' => t('manage fields'),
      'href' => 'admin/structure/command-buttons/manage/' . $type_url_str . '/fields',
    );
    $operations['display'] = array(
      'title' => t('manage display'),
      'href' => 'admin/structure/command-buttons/manage/' . $type_url_str . '/display',
    );
    $ops = theme('links', array(
      'links' => $operations,
      'attributes' => array(
        'class' => array(
          'links',
          'inline',
        ),
      ),
    ));
    $row[] = $ops;
    $rows[] = $row;
  }
  $build['panes_table'] = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
  );
  return $build;
}