You are here

public function fieldable_panels_pane::list_footer in Fieldable Panels Panes (FPP) 7

List footer.

Overrides ctools_export_ui::list_footer

File

plugins/export_ui/fieldable_panels_pane.class.php, line 159
Class for Export UI to manage Fieldable Panels Pane bundles.

Class

fieldable_panels_pane
Fieldable Panels Panes type Export UI plugin class.

Code

public function list_footer($form_state) {
  ctools_include('export');
  $items = ctools_export_crud_load_all('fieldable_panels_pane_type');
  $entity_info = entity_get_info('fieldable_panels_pane');
  $header = array(
    t('Name'),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  $rows = array();
  if (!empty($entity_info['bundles'])) {
    foreach ($entity_info['bundles'] as $bundle => $info) {

      // Filter out bundles that already exist as ctools exportable objects.
      if (isset($items[$bundle])) {
        continue;
      }
      $row = array();
      $label = check_plain($info['label']);
      $label .= ' <small>' . t('(Machine name: @type)', array(
        '@type' => $bundle,
      )) . '</small>';
      $row[] = $label;
      $operations = array();
      if (user_access('administer fieldable panels panes') || user_access('access fieldable panels panes master list')) {
        $operations['list'] = array(
          'title' => t('list'),
          'href' => 'admin/structure/fieldable-panels-panes/' . $bundle,
        );
      }
      if (user_access('administer fieldable panels panes')) {
        $operations['add'] = array(
          'title' => t('add'),
          'href' => 'admin/structure/fieldable-panels-panes/' . $bundle . '/add',
        );
        $operations['edit'] = array(
          'title' => t('edit'),
          'href' => 'admin/structure/fieldable-panels-panes/' . $bundle . '/edit',
        );
        $operations['delete'] = array(
          'title' => t('delete'),
          'href' => 'admin/structure/fieldable-panels-panes/' . $bundle . '/delete',
        );
        $operations['export'] = array(
          'title' => t('export'),
          'href' => 'admin/structure/fieldable-panels-panes/' . $bundle . '/export',
        );
        if (module_exists('field_ui')) {
          $operations['fields'] = array(
            'title' => t('manage fields'),
            'href' => $this
              ->field_admin_path($bundle, 'fields'),
          );
          $operations['display'] = array(
            'title' => t('manage display'),
            'href' => $this
              ->field_admin_path($bundle, 'display'),
          );
        }
      }
      $ops = theme('links', array(
        'links' => $operations,
        'attributes' => array(
          'class' => array(
            'links',
            'inline',
          ),
        ),
      ));
      $row[] = $ops;
      $rows[] = $row;
    }
    if (!empty($rows)) {
      $variables = array(
        'caption' => t('Legacy bundles that are not managed by the bundle administrative UI are listed here.'),
        'header' => $header,
        'rows' => $rows,
      );
      return theme('table', $variables);
    }
  }
}