You are here

function entity_share_ui_endpoint_list in Entity Share 7

Node list table.

Return value

array The render array of the endpoint list.

1 string reference to 'entity_share_ui_endpoint_list'
entity_share_ui_client_menu in modules/entity_share_ui/modules/entity_share_ui_client/entity_share_ui_client.module
Implements hook_menu().

File

modules/entity_share_ui/modules/entity_share_ui_client/entity_share_ui_client.config.admin.inc, line 16
Entity Share UI Client Admin Configuration file.

Code

function entity_share_ui_endpoint_list() {
  drupal_set_title(t('Entity Share Client - Endpoints'));

  // Table header.
  $header = array(
    'title' => array(
      'data' => t('Title'),
    ),
    'description' => array(
      'data' => t('Description'),
    ),
    'url' => array(
      'data' => t('URL'),
    ),
    'enable' => array(
      'data' => t('Enable'),
    ),
    'debug' => array(
      'data' => t('Debug'),
    ),
    'actions' => array(
      'data' => t('Action'),
    ),
  );
  $endpoints = EntityShareUiClientEndpoint::loadAll();
  $rows = array();
  if ($endpoints) {
    foreach ($endpoints as $endpoint) {
      $rows[$endpoint['eid']] = array(
        'title' => array(
          'data' => array(
            '#type' => 'link',
            '#title' => $endpoint['title'],
            '#href' => 'admin/entity_share/endpoint/' . $endpoint['name'] . '/edit',
          ),
        ),
        'description' => check_plain($endpoint['description']),
        'url' => $endpoint['url'],
        'enable' => $endpoint['enabled'] ? t('Enabled') : t('Disabled'),
        'debug' => $endpoint['debug'] ? t('Enabled') : t('Disabled'),
      );
      $rows[$endpoint['eid']]['actions'] = array(
        'data' => array(
          '#theme' => 'links',
          '#attributes' => array(
            'class' => array(
              'links',
              'inline',
            ),
          ),
          '#links' => array(
            'edit' => array(
              'title' => t('edit'),
              'href' => 'admin/entity_share/endpoint/' . $endpoint['name'] . '/edit',
            ),
            'delete' => array(
              'title' => t('delete'),
              'href' => 'admin/entity_share/endpoint/' . $endpoint['name'] . '/delete',
            ),
          ),
        ),
      );
    }
  }

  // Create a render array ($build) which will be themed as a table.
  $build = array(
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $rows,
    '#empty' => t('There is no endpoint...'),
  );
  return $build;
}