public function SlickAdmin::openingForm in Slick Carousel 7.3
Same name and namespace in other branches
- 8.2 src/Form/SlickAdmin.php \Drupal\slick\Form\SlickAdmin::openingForm()
- 8 src/Form/SlickAdmin.php \Drupal\slick\Form\SlickAdmin::openingForm()
Returns the opening form elements.
Overrides BlazyAdminExtended::openingForm
1 call to SlickAdmin::openingForm()
- SlickAdmin::buildSettingsForm in src/
Form/ SlickAdmin.php - Returns the main form elements.
File
- src/
Form/ SlickAdmin.php, line 76
Class
- SlickAdmin
- Provides resusable admin functions, or form elements.
Namespace
Drupal\slick\FormCode
public function openingForm(array &$form, &$definition = []) {
$readme = module_exists('slick_ui') ? url('admin/help/slick_ui') : '/admin/help/slick_ui';
$readme_field = module_exists('slick_fields') ? url('admin/help/slick_fields') : '/admin/help/slick_fields';
$arrows = $this
->getSkinsByGroupOptions('arrows');
$dots = $this
->getSkinsByGroupOptions('dots');
if (!isset($form['optionset'])) {
parent::openingForm($form, $definition);
$form['optionset']['#title'] = t('Optionset main');
if (module_exists('slick_ui')) {
$form['optionset']['#description'] = t('Manage optionsets at <a href="@url" target="_blank">the optionset admin page</a>.', [
'@url' => url('admin/config/media/slick'),
]);
}
}
if (!empty($definition['nav']) || !empty($definition['thumbnails'])) {
$form['optionset_thumbnail'] = [
'#type' => 'select',
'#title' => t('Optionset thumbnail'),
'#options' => $this
->getOptionsetsByGroupOptions('thumbnail'),
'#description' => t('If provided, asNavFor aka thumbnail navigation applies. Leave empty to not use thumbnail navigation.'),
'#weight' => -107,
];
$form['skin_thumbnail'] = [
'#type' => 'select',
'#title' => t('Skin thumbnail'),
'#options' => $this
->getSkinsByGroupOptions('thumbnail'),
'#description' => t('Thumbnail navigation skin. See main <a href="@url" target="_blank">README</a> for details on Skins. Leave empty to not use thumbnail navigation.', [
'@url' => $readme,
]),
'#weight' => -106,
];
}
if (count($arrows) > 0) {
$form['skin_arrows'] = [
'#type' => 'select',
'#title' => t('Skin arrows'),
'#options' => $arrows ?: [],
'#enforced' => TRUE,
'#description' => t('Implement \\Drupal\\slick\\SlickSkinInterface::arrows() to add your own arrows skins, in the same format as SlickSkinInterface::skins().'),
'#weight' => -105,
];
}
if (count($dots) > 0) {
$form['skin_dots'] = [
'#type' => 'select',
'#title' => t('Skin dots'),
'#options' => $dots ?: [],
'#enforced' => TRUE,
'#description' => t('Implement \\Drupal\\slick\\SlickSkinInterface::dots() to add your own dots skins, in the same format as SlickSkinInterface::skins().'),
'#weight' => -105,
];
}
if (!empty($definition['thumb_positions'])) {
$form['thumbnail_position'] = [
'#type' => 'select',
'#title' => t('Thumbnail position'),
'#options' => [
'left' => t('Left'),
'right' => t('Right'),
'top' => t('Top'),
'over-left' => t('Overlay left'),
'over-right' => t('Overlay right'),
'over-top' => t('Overlay top'),
],
'#description' => t('By default thumbnail is positioned at bottom. Hence to change the position of thumbnail. Only reasonable with 1 visible main stage at a time. Except any TOP, the rest requires Vertical option enabled for Optionset thumbnail, and a custom CSS height to selector <strong>.slick--thumbnail</strong> to avoid overflowing tall thumbnails, or adjust <strong>slidesToShow</strong> to fit the height. Further theming is required as usual. Overlay is absolutely positioned over the stage rather than sharing the space. See skin <strong>X VTabs</strong> for vertical thumbnail sample.'),
'#states' => [
'visible' => [
'select[name*="[optionset_thumbnail]"]' => [
'!value' => '',
],
],
],
'#weight' => -96,
];
}
if (!empty($definition['thumb_captions'])) {
$form['thumbnail_caption'] = [
'#type' => 'select',
'#title' => t('Thumbnail caption'),
'#options' => $definition['thumb_captions'],
'#description' => t('Thumbnail caption maybe just title/ plain text. If Thumbnail image style is not provided, the thumbnail pagers will be just text like regular tabs.'),
'#states' => [
'visible' => [
'select[name*="[optionset_thumbnail]"]' => [
'!value' => '',
],
],
],
'#weight' => 2,
];
}
if (isset($form['skin'])) {
$form['skin']['#title'] = t('Skin main');
$form['skin']['#description'] = t('Skins allow various layouts with just CSS. Some options below depend on a skin. However a combination of skins and options may lead to unpredictable layouts, get yourself dirty. E.g.: Skin Split requires any split layout option. Failing to choose the expected layout makes it useless. See <a href="@url" target="_blank">SKINS section</a> at /admin/help/slick_ui for details on Skins. Leave empty to DIY. Or use hook_slick_skins_info() and implement \\Drupal\\slick\\SlickSkinInterface to register ones. Skins are permanently cached. Clear cache if new skins do not appear.', [
'@url' => $readme,
]);
}
if (isset($form['layout'])) {
$form['layout']['#description'] = t('Requires a skin. The builtin layouts affects the entire slides uniformly. Split half requires any skin Split. See Slick Fields <a href="@url" target="_blank">README</a> under "Slide layout" for more info. Leave empty to DIY.', [
'@url' => $readme_field,
]);
}
$weight = -99;
foreach (element_children($form) as $key) {
if (!isset($form[$key]['#weight'])) {
$form[$key]['#weight'] = ++$weight;
}
}
}