Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $settings = $this->options;
     // Get the active field options.
     $options = $this->confGetFieldSources();
     $missing_field_warning = '';
     if (empty($options['field_options_images'])) {
         $missing_field_warning = t('<strong>You must add a field of type image, file or file ID to your view display before this value can be set.</strong><br/>');
     }
     // Add the view-specific elements.
     $form['image_field'] = array('#type' => 'select', '#title' => t('Image Source'), '#default_value' => $settings['image_field'], '#description' => t('The field source to use for each image in the gallery. Must be an image field, file field or a file ID. If using a multivalued field (*) only the <em>first</em> value from each entity will be used.'), '#suffix' => $missing_field_warning, '#options' => $options['field_options_images'], '#empty_option' => t('- Select -'));
     $form['thumb_field'] = array('#type' => 'select', '#title' => t('Thumbnail Source'), '#default_value' => $settings['thumb_field'], '#description' => t('The field source to use for each thumbnail in the gallery. Must be an image field, file field or a file ID. Typically you will choose the same value that was set in the "Image Source" option above.'), '#suffix' => $missing_field_warning, '#options' => $options['field_options_images'], '#empty_option' => t('- Select -'));
     $form['image_field_style'] = array('#type' => 'select', '#title' => t('Image Field Style'), '#default_value' => $settings['image_field_style'], '#description' => t('The style formatter for the image. Any formatting settings configured on the field itself will be ignored and this style setting will always be used.'), '#options' => $this->juicebox->confBaseStylePresets(), '#empty_option' => t('None (original image)'));
     $form['thumb_field_style'] = array('#type' => 'select', '#title' => t('Thumbnail Field Style'), '#default_value' => $settings['thumb_field_style'], '#description' => t('The style formatter for the thumbnail. Any formatting settings configured on the field itself will be ignored and this style setting will always be used.'), '#options' => $this->juicebox->confBaseStylePresets(FALSE), '#empty_option' => t('None (original image)'));
     $form['title_field'] = array('#type' => 'select', '#title' => t('Title Field'), '#default_value' => $settings['title_field'], '#description' => t('The view\'s field that should be used for the title of each image in the gallery. Any formatting settings configured on the field itself will be respected.'), '#options' => $options['field_options'], '#empty_option' => t('None'));
     $form['caption_field'] = array('#type' => 'select', '#title' => t('Caption Field'), '#default_value' => $settings['caption_field'], '#description' => t('The view\'s field that should be used for the caption of each image in the gallery. Any formatting settings configured on the field itself will be respected.'), '#options' => $options['field_options'], '#empty_option' => t('None'));
     $form['show_title'] = array('#type' => 'checkbox', '#title' => t('Show Gallery Title'), '#default_value' => $settings['show_title'], '#description' => t('Show the view display title as the gallery title.'));
     // Add the common form elements.
     $form = $this->juicebox->confBaseForm($form, $settings);
     // Add view-sepcific field options for the linkURL setting.
     $linkurl_field_options = array();
     foreach ($options['field_options'] as $field_key => $field_name) {
         $linkurl_field_options[$field_key] = t('Field') . ' - ' . $field_name;
     }
     $form['linkurl_source']['#description'] = $form['linkurl_source']['#description'] . '</br><strong>' . t('If using a field source it must render a properly formatted URL and nothing else.') . '</strong>';
     $form['linkurl_source']['#options'] = array_merge($form['linkurl_source']['#options'], $linkurl_field_options);
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function settingsSummary()
 {
     $settings = $this->getSettings();
     // Get available image style presets
     $presets = $this->juicebox->confBaseStylePresets();
     $settings_display = array();
     // Image style setting.
     if (!empty($settings['image_style']) && isset($presets[$settings['image_style']])) {
         $style = $presets[$settings['image_style']];
     } else {
         $style = t('Original Image');
     }
     $settings_display[] = t("Image style: @style", array('@style' => $style));
     // Thumb style setting.
     if (!empty($settings['thumb_style']) && isset($presets[$settings['thumb_style']])) {
         $style = $presets[$settings['thumb_style']];
     } else {
         $style = t('Original Image');
     }
     $settings_display[] = t("Thumbnail style: @style", array('@style' => $style));
     // Define display options for caption and title source.
     $text_sources = $this->getFieldTextSources();
     // Caption source setting.
     if (!empty($text_sources[$settings['caption_source']])) {
         $source = $text_sources[$settings['caption_source']];
     } else {
         $source = t('None');
     }
     $settings_display[] = t("Caption source: @source", array('@source' => $source));
     // Title source setting.
     if (!empty($text_sources[$settings['title_source']])) {
         $source = $text_sources[$settings['title_source']];
     } else {
         $source = t('None');
     }
     $settings_display[] = t("Title source: @source", array('@source' => $source));
     // Add-in a note about the additional fieldsets.
     $settings_display[] = t("Additional Juicebox library configuration options may also be set.");
     return $settings_display;
 }