function slick_get_fieldable_elements in Slick Carousel 7.2
Same name and namespace in other branches
- 7.3 includes/slick.admin.inc \slick_get_fieldable_elements()
Returns shared fieldable form elements for Slick field formatter and Views.
1 call to slick_get_fieldable_elements()
- _slick_fields_field_formatter_settings_form in slick_fields/
includes/ slick_fields.formatters.admin.inc - Off-loaded hook_field_formatter_settings_form().
File
- includes/
slick.admin.inc, line 524 - Contains optional functions called only if needed by admin pages.
Code
function slick_get_fieldable_elements(array &$elements, $settings, $definition = array()) {
$slick_fields = url(drupal_get_path('module', 'slick_fields') . '/README.txt');
$layout_builtin = slick_layouts();
$image_options = isset($definition['images']) ? $definition['images'] : array();
$thumb_options = isset($definition['thumbnails']) ? $definition['thumbnails'] : array();
$overlay_options = isset($definition['overlays']) ? $definition['overlays'] : array();
$layout_options = isset($definition['layouts']) ? $definition['layouts'] : array();
$title_options = isset($definition['titles']) ? $definition['titles'] : array();
$link_options = isset($definition['links']) ? $definition['links'] : array();
$caption_options = isset($definition['captions']) ? $definition['captions'] : array();
$tn_caption_options = isset($definition['thumb_captions']) ? $definition['thumb_captions'] : array();
$class_options = isset($definition['classes']) ? $definition['classes'] : array();
$fieldable = isset($definition['fieldable']) || isset($definition['overlays']);
$elements['slide_layout'] = array(
'#type' => 'select',
'#title' => t('Slide layout'),
'#options' => $layout_options + $layout_builtin,
'#prefix' => '<h3 class="form--slick__title">' . t('Fields') . '</h3>',
'#description' => t('Two options: <ol><li>A custom list text field, to control each slide layout. Choose "key" under its Formatter.</li><li>Builtin layouts, to apply uniformly to all slides.</li></ol>Leave empty to DIY. <a href="@url">Read more</a> about layouts.', array(
'@url' => $slick_fields,
)),
'#access' => isset($definition['layouts']),
);
if ($fieldable) {
$elements['slide_title'] = array(
'#type' => 'select',
'#title' => t('Slide title'),
'#options' => $title_options,
'#description' => t('If provided, it will be wrapped with H2 and class .slide__title.'),
'#access' => isset($definition['titles']),
);
}
if (isset($definition['images'])) {
$elements['slide_image'] = array(
'#type' => 'select',
'#title' => t('Main image'),
'#options' => $image_options,
'#description' => t('Main image, treated as background if overlay is provided. It will be lazy-loaded if the Formatter is <strong>Image</strong> and lazyLoad is enabled. Only one image is displayed per slide, even if it is a multi-value field.'),
'#access' => isset($definition['images']),
);
}
if (isset($definition['thumbnails'])) {
$elements['slide_thumbnail'] = array(
'#type' => 'select',
'#title' => t('Thumbnail image'),
'#options' => $thumb_options,
'#description' => t("Only needed if <em>Option set thumbnail</em> is provided. Maybe the same field as the main image, only different instance. Leave empty to not use thumbnail pager."),
'#access' => isset($definition['thumbnails']),
);
}
$elements['thumbnail_caption'] = array(
'#type' => 'select',
'#title' => t('Thumbnail caption'),
'#options' => $tn_caption_options,
'#description' => t('Thumbnail caption maybe just title/ plain text. If Thumbnail image is not provided, the thumbnail pagers will be just text like regular tabs.'),
'#access' => isset($definition['thumb_captions']),
);
if ($fieldable) {
$elements['slide_overlay'] = array(
'#type' => 'select',
'#title' => t('Overlay media/slicks'),
'#options' => $overlay_options,
'#description' => t('For audio/video, be sure the display is not image. For nested slicks, use the Slick carousel formatter for this field. Zebra layout is reasonable for overlay and captions.'),
'#access' => isset($definition['overlays']),
);
}
if (isset($definition['links'])) {
$elements['slide_link'] = array(
'#type' => 'select',
'#title' => t('Link'),
'#options' => $link_options,
'#description' => t('Link to content: Read more, View Case Study, etc, wrapped with class .slide__link.'),
'#access' => isset($definition['links']),
);
}
if (isset($definition['classes'])) {
$elements['slide_classes'] = array(
'#title' => t('Slide class'),
'#type' => 'select',
'#options' => $class_options,
'#description' => t('If provided, individual slide will have this class, e.g.: to have different background with transparent images and skin Split, or Slick filtering. Be sure to have a Key, Label or Plain text under Formatter without links accordingly. Supported fields: Node title, Entityreference, Taxonomy term, List, Text.'),
'#access' => isset($definition['classes']),
);
}
$slide_captions = is_array($settings['slide_caption']) ? array_values($settings['slide_caption']) : $settings['slide_caption'];
$elements['slide_caption'] = array(
'#type' => 'checkboxes',
'#title' => t('Caption fields'),
'#description' => t("Select fields for the caption, excluding those already selected above."),
'#options' => $caption_options,
'#default_value' => $slide_captions,
'#access' => isset($definition['captions']),
);
}