public function BeautytipsManagerController::customStylesOverview in BeautyTips 8
Custom styles administration.
1 string reference to 'BeautytipsManagerController::customStylesOverview'
- beautytips_manager.routing.yml in beautytips_manager/
beautytips_manager.routing.yml - beautytips_manager/beautytips_manager.routing.yml
File
- beautytips_manager/
src/ Controller/ BeautytipsManagerController.php, line 62
Class
Namespace
Drupal\beautytips_manager\ControllerCode
public function customStylesOverview() {
$options = $rows = [];
$header = [
$this
->t('Name'),
$this
->t('operations'),
'',
];
$styles = beautytips_manager_get_custom_styles();
if (count($styles)) {
foreach ($styles as $style) {
$name = Html::escape($style->name);
unset($style->name);
$rows[$style->id]['name'] = new \Drupal\Component\Render\FormattableMarkup("<span class='bt-style-{$name}'>%name</span>", [
'%name' => $name,
]);
// $rows[$style->id]['name'] = '<span class="bt-style-' . $name . '">' . $name . '</span>';
$url = Url::fromUserInput("/admin/config/user-interface/beautytips/custom-styles/{$style->id}/edit");
$rows[$style->id]['edit'] = Link::fromTextAndUrl($this
->t('the block admin page'), $url)
->toString();
if ($name != \Drupal::config('beautytips.basic')
->get('beautytips_default_style')) {
$url = Url::fromUserInput("/admin/config/user-interface/beautytips/custom-styles/{$style->id}/delete");
$rows[$style->id]['delete'] = Link::fromTextAndUrl($this
->t('delete'), $url)
->toString();
}
else {
$rows[$style->id]['delete'] = $this
->t('Default style');
}
$options[][$name] = [
'cssSelect' => 'td .bt-style-' . $name,
'text' => $this
->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,
];
}
}
else {
return [
'#type' => 'markup',
'#markup' => $this
->t('There are no custom beautytip styles yet.'),
];
}
$table = [
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
];
beautytips_add_beautytips($table, [
$name => $options,
]);
return $table;
}