public function SlickListBuilder::render in Slick Carousel 8
Same name and namespace in other branches
- 8.2 slick_ui/src/Controller/SlickListBuilder.php \Drupal\slick_ui\Controller\SlickListBuilder::render()
Adds some descriptive text to the slick optionsets list.
Return value
array Renderable array.
Overrides DraggableListBuilder::render
File
- slick_ui/
src/ Controller/ SlickListBuilder.php, line 127
Class
- SlickListBuilder
- Provides a listing of Slick optionsets.
Namespace
Drupal\slick_ui\ControllerCode
public function render() {
$manager = $this->manager;
$build['description'] = [
'#markup' => $this
->t("<p>Manage the Slick optionsets. Optionsets are Config Entities.</p><p>By default, when this module is enabled, a single optionset is created from configuration. Install Slick example module to speed up by cloning them. Use the Operations column to edit, clone and delete optionsets.<br /><strong>Important!</strong> Avoid overriding Default optionset as it is meant for Default -- checking and cleaning. Use Duplicate instead. Otherwise messes are yours.<br />Slick doesn't need Slick UI to run. It is always safe to uninstall Slick UI once done with optionsets.</p>"),
];
$availaible_skins = [];
$skins = $manager
->getSkins()['skins'];
foreach ($skins as $key => $skin) {
$name = isset($skin['name']) ? $skin['name'] : $key;
$group = isset($skin['group']) ? Html::escape($skin['group']) : 'None';
$provider = isset($skin['provider']) ? Html::escape($skin['provider']) : 'Lory';
$description = isset($skin['description']) ? Html::escape($skin['description']) : $this
->t('No description');
$markup = '<h3>' . $this
->t('@skin <br><small>Id: @id | Group: @group | Provider: @provider</small>', [
'@skin' => $name,
'@id' => $key,
'@group' => $group,
'@provider' => $provider,
]) . '</h3>';
$markup .= '<p><em>— ' . $description . '</em></p>';
$availaible_skins[$key] = [
'#markup' => '<div class="messages messages--status">' . $markup . '</div>',
];
}
ksort($availaible_skins);
$availaible_skins = [
'default' => $availaible_skins['default'],
] + $availaible_skins;
$settings = [];
$settings['grid'] = 3;
$settings['grid_medium'] = 2;
$settings['blazy'] = FALSE;
$settings['style'] = 'column';
$header = '<br><hr><h2>' . $this
->t('Available skins') . '</h2>';
$header .= '<p>' . $this
->t('Some skin works best with a specific Optionset, and vice versa. Use matching names if found. Else happy adventure!') . '</p>';
$build['skins_header']['#markup'] = $header;
$build['skins_header']['#weight'] = 20;
$build['skins'] = BlazyGrid::build($availaible_skins, $settings);
$build['skins']['#weight'] = 21;
$build['skins']['#attached'] = $manager
->attach($settings);
$build['skins']['#attached']['library'][] = 'blazy/admin';
$build[] = parent::render();
return $build;
}