You are here

function beautytips_manager_styles_manager_page in BeautyTips 7.2

Page callback for custom styles administration.

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

File

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

Code

function beautytips_manager_styles_manager_page() {
  $rows = [];
  $empty = '';
  $header = [
    t('Name'),
    t('operations'),
    '',
  ];
  $styles = beautytips_manager_get_custom_styles();
  if (count($styles)) {
    $visibility = [
      t('Show on every page except the listed pages.'),
      t('Show on only the listed pages.'),
    ];
    foreach ($styles as $style) {
      $name = check_plain($style->name);
      unset($style->name);
      $rows[$style->id]['name'] = '<span class="bt-style-' . $name . '">' . $name . '</span>';
      $rows[$style->id]['edit'] = l(t('edit'), "admin/config/user-interface/beautytips/custom-styles/{$style->id}/edit");
      if ($name != variable_get('beautytips_default_style', 'plain')) {
        $rows[$style->id]['delete'] = l(t('delete'), "admin/config/user-interface/beautytips/custom-styles/{$style->id}/delete");
      }
      else {
        $rows[$style->id]['delete'] = t('Default style');
      }
      $options = [
        'cssSelect' => 'td .bt-style-' . $name,
        'text' => t('<h2>Default Text</h2><p>Nam magna enim, accumsan eu, blandit sed, blandit a, eros.  Nam ante nulla, interdum vel, tristique ac, condimentum non, tellus.</p><p>Nulla facilisi. Nam magna enim, accumsan eu, blandit sed, blandit a, eros.</p>'),
        'trigger' => 'hover',
        'style' => $name,
      ];
      beautytips_add_beautytips([
        $name => $options,
      ]);
    }
  }
  else {
    $empty = t('There are no custom beautytip styles yet.');
  }
  return theme('table', [
    'header' => $header,
    'rows' => $rows,
  ]) . $empty;
}