You are here

function fieldable_panels_panes_panels_dashboard_blocks in Fieldable Panels Panes (FPP) 7

Implements hook_panels_dashboard_blocks().

File

./fieldable_panels_panes.module, line 557
Maintains an entity that appears as panel pane content.

Code

function fieldable_panels_panes_panels_dashboard_blocks(&$vars) {
  ctools_include('export');
  $vars['links']['fieldable_panels_panes'] = array(
    'title' => l(t('Fieldable Panels Panes'), 'admin/structure/fieldable-panels-panes'),
    'description' => t('Fieldable Panels Panes are fieldable entities that can be created directly in the Panels UI or created in a separate administrative UI to reuse later in a panel pane.'),
  );
  $count = 0;
  $rows = array();
  foreach (ctools_export_crud_load_all('fieldable_panels_pane_type') as $type) {
    $items = array(
      $type->title,
      l(t('List'), 'admin/structure/fieldable-panels-panes/' . $type->name),
      l(t('Edit'), 'admin/structure/fieldable-panels-panes/' . $type->name . '/edit'),
      l(t('Add'), 'admin/structure/fieldable-panels-panes/' . $type->name . '/add'),
    );
    if (module_exists('field_ui')) {
      $items[] = l(t('Manage Fields'), 'admin/structure/fieldable-panels-panes/' . $type->name . '/fields');
      $items[] = l(t('Manage Display'), 'admin/structure/fieldable-panels-panes/' . $type->name . '/display');
    }
    $rows[] = $items;

    // Only display 10.
    if (++$count >= 10) {
      break;
    }
  }
  if ($rows) {
    $content = theme('table', array(
      'rows' => $rows,
      'attributes' => array(
        'class' => 'panels-manage',
      ),
    ));
  }
  else {
    $content = '<p>' . t('There are no fieldable panel pane types.') . '</p>';
  }
  $vars['blocks']['fieldable_panels_panes'] = array(
    'weight' => -100,
    'title' => t('Manage fieldable panels panes'),
    'link' => l(t('Go to list'), 'admin/structure/fieldable-panels-panes'),
    'content' => $content,
    'class' => 'dashboard-fieldable-panels-panes',
    'section' => 'right',
  );
}