You are here

function beautytips_manager_tips_manager_page in BeautyTips 7.2

Same name and namespace in other branches
  1. 6.2 beautytips_manager.module \beautytips_manager_tips_manager_page()

Listing of all beautytips available.

1 string reference to 'beautytips_manager_tips_manager_page'
beautytips_manager_menu in ./beautytips_manager.module
Implements hook_menu().

File

./beautytips_manager.admin.inc, line 11
Administration pages and forms for beautytips manager.

Code

function beautytips_manager_tips_manager_page() {
  $rows = [];
  $empty = '';
  $header = [
    t('Element'),
    t('Style'),
    t('Status'),
    t('Visibility'),
    t('Pages'),
    t('operations'),
    '',
  ];
  $tips = beautytips_manager_get_custom_tips();
  if (count($tips)) {
    $visibility = [
      t('Show on every page except the listed pages.'),
      t('Show on only the listed pages.'),
    ];
    foreach ($tips as $tip) {
      $tip->pages = check_plain($tip->pages);
      $pages = $tip->pages != substr($tip->pages, 0, 40) ? substr($tip->pages, 0, 40) . '...' : substr($tip->pages, 0, 40);
      $rows[$tip->id]['element'] = check_plain($tip->element);
      $rows[$tip->id]['style'] = $tip->style;
      $rows[$tip->id]['enabled'] = $tip->enabled ? t('Enabled') : t('Disabled');
      $rows[$tip->id]['visibility'] = $visibility[$tip->visibility];
      $rows[$tip->id]['pages'] = $pages;
      $rows[$tip->id]['edit'] = l(t('edit'), "admin/config/user-interface/beautytips/custom-tips/{$tip->id}/edit");
      $rows[$tip->id]['delete'] = l(t('delete'), "admin/config/user-interface/beautytips/custom-tips/{$tip->id}/delete");
    }
  }
  else {
    $empty = t('There are no custom beautytips yet.');
  }
  return theme('table', [
    'header' => $header,
    'rows' => $rows,
  ]) . $empty;
}