コード例 #1
0
ファイル: Jssor.php プロジェクト: rafavergara/ddv8
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     // Get all image and text fields.
     $image_options = [];
     $caption_options = [];
     $transitions_options = ['Move' => ['L' => 'L', 'R' => 'R', 'T' => 'T', 'B' => 'B', 'TL' => 'TL', 'TR' => 'TR', 'BL' => 'BL', 'BR' => 'BR'], 'Move|IB' => ['L|IB' => 'L|IB', 'R|IB' => 'R|IB', 'T|IB' => 'T|IB', 'B|IB' => 'B|IB', 'TL|IB' => 'TL|IB', 'TR|IB' => 'TR|IB', 'BL|IB' => 'BL|IB', 'BR|IB' => 'BR|IB'], 'Move|IE' => ['L|IE' => 'L|IE', 'R|IE' => 'R|IE', 'T|IE' => 'T|IE', 'B|IE' => 'B|IE', 'TL|IE' => 'TL|IE', 'TR|IE' => 'TR|IE', 'BL|IE' => 'BL|IE', 'BR|IE' => 'BR|IE'], 'Move|EP' => ['L|EP' => 'L|EP', 'R|EP' => 'R|EP', 'T|EP' => 'T|EP', 'B|EP' => 'B|EP', 'TL|EP' => 'TL|EP', 'TR|EP' => 'TR|EP', 'BL|EP' => 'BL|EP', 'BR|EP' => 'BR|EP'], 'Move with Rotate' => ['L*' => 'L*', 'R*' => 'R*', 'T*' => 'T*', 'B*' => 'B*', 'TL*' => 'TL*', 'TR*' => 'TR*', 'BL*' => 'BL*', 'BR*' => 'BR*'], 'Move with Rotate IE' => ['L*IE' => 'L*IE', 'R*IE' => 'R*IE', 'T*IE' => 'T*IE', 'B*IE' => 'B*IE', 'TL*IE' => 'TL*IE', 'TR*IE' => 'TR*IE', 'BL*IE' => 'BL*IE', 'BR*IE' => 'BR*IE'], 'Move with Rotate IB' => ['L*IB' => 'L*IB', 'R*IB' => 'R*IB', 'T*IB' => 'T*IB', 'B*IB' => 'B*IB', 'TL*IB' => 'TL*IB', 'TR*IB' => 'TR*IB', 'BL*IB' => 'BL*IB', 'BR*IB' => 'BR*IB'], 'Move with Rotate IW' => ['L*IW' => 'L*IW', 'R*IW' => 'R*IW', 'T*IW' => 'T*IW', 'B*IW' => 'B*IW', 'TL*IW' => 'TL*IW', 'TR*IW' => 'TR*IW', 'BL*IW' => 'BL*IW', 'BR*IW' => 'BR*IW'], 'Move IE with Rotate IE' => ['L*IE*IE' => 'L*IE*IE', 'R*IE*IE' => 'R*IE*IE', 'T*IE*IE' => 'T*IE*IE', 'B*IE*IE' => 'B*IE*IE', 'TL*IE*IE' => 'TL*IE*IE', 'TR*IE*IE' => 'TR*IE*IE', 'BL*IE*IE' => 'BL*IE*IE', 'BR*IE*IE' => 'BR*IE*IE'], 'Clip' => ['CLIP' => 'CLIP', 'CLIP|LR' => 'CLIP|LR', 'CLIP|TB' => 'CLIP|TB', 'CLIP|L' => 'CLIP|L', 'CLIP|R' => 'CLIP|R', 'CLIP|T' => 'CLIP|T', 'CLIP|B' => 'CLIP|B'], 'MClip' => ['MCLIP|L' => 'MCLIP|L', 'MCLIP|R' => 'MCLIP|R', 'MCLIP|T' => 'MCLIP|T', 'MCLIP|B' => 'MCLIP|B'], 'Zoom' => ['ZM' => 'ZM', 'ZM|P30' => 'ZM|P30', 'ZM|P50' => 'ZM|P50', 'ZM|P70' => 'ZM|P70', 'ZM|P80' => 'ZM|P80', 'ZMF|2' => 'ZMF|2', 'ZMF|3' => 'ZMF|3', 'ZMF|4' => 'ZMF|4', 'ZMF|5' => 'ZMF|5', 'ZMF|10' => 'ZMF|10', 'ZML|L' => 'ZML|L', 'ZML|R' => 'ZML|R', 'ZML|T' => 'ZML|T', 'ZML|B' => 'ZML|B', 'ZML|TL' => 'ZML|TL', 'ZML|TR' => 'ZML|TR', 'ZML|BL' => 'ZML|BL', 'ZML|BR' => 'ZML|BR', 'ZML|IE|L' => 'ZML|IE|L', 'ZML|IE|R' => 'ZML|IE|R', 'ZML|IE|T' => 'ZML|IE|T', 'ZML|IE|B' => 'ZML|IE|B', 'ZML|IE|TL' => 'ZML|IE|TL', 'ZML|IE|TR' => 'ZML|IE|TR', 'ZML|IE|BL' => 'ZML|IE|BL', 'ZML|IE|BR' => 'ZML|IE|BR', 'ZMS|L' => 'ZMS|L', 'ZMS|R' => 'ZMS|R', 'ZMS|T' => 'ZMS|T', 'ZMS|B' => 'ZMS|B', 'ZMS|TL' => 'ZMS|TL', 'ZMS|TR' => 'ZMS|TR', 'ZMS|BL' => 'ZMS|BL', 'ZMS|BR' => 'ZMS|BR']];
     if ($fields = $this->view->display_handler->getOption('fields')) {
         foreach ($fields as $id => $field) {
             switch ($field['type']) {
                 case 'image':
                     $image_options[$id] = $field['id'];
                     break;
                 case 'string':
                     $caption_options[$id] = $field['id'];
                     break;
             }
         }
     }
     $form['image_options'] = array('#type' => 'select', '#title' => $this->t('Image field'), '#description' => $this->t('Select image field.'), '#options' => $image_options, '#default_value' => $this->options['image_options']);
     $form['caption_options'] = array('#type' => 'select', '#title' => $this->t('Caption field'), '#description' => $this->t('Select caption field.'), '#options' => $caption_options, '#default_value' => $this->options['caption_options']);
     $form['play_in_mode'] = ['#type' => 'select', '#title' => $this->t('Play in mode'), '#description' => $this->t('Specifies how captions will play in.'), '#options' => [0 => $this->t('No play'), 1 => $this->t('Goes after main slide played in, play captions in one by one'), 3 => $this->t('Goes after main slide played in, play all captions in parallelly')], '#default_value' => $this->options['play_in_mode']];
     $form['play_in_transition'] = ['#type' => 'select', '#title' => $this->t('Transition'), '#description' => $this->t('Transition.'), '#options' => $transitions_options, '#default_value' => $this->options['play_in_transition']];
     $form['play_out_mode'] = ['#type' => 'select', '#title' => $this->t('Play in mode'), '#description' => $this->t('Specifies how captions will play in.'), '#options' => [0 => $this->t('No play'), 1 => $this->t('Goes after main slide played in, play captions in one by one'), 3 => $this->t('Goes after main slide played in, play all captions in parallelly')], '#default_value' => $this->options['play_out_mode']];
     $form['play_out_transition'] = ['#type' => 'select', '#title' => $this->t('Transition'), '#description' => $this->t('Transition.'), '#options' => $transitions_options, '#default_value' => $this->options['play_out_transition']];
 }
コード例 #2
0
ファイル: RssPluginBase.php プロジェクト: aWEBoLabs/taxi
 /**
  * {@inheritdoc}
  */
 public function calculateDependencies()
 {
     $dependencies = parent::calculateDependencies();
     $view_mode = $this->entityManager->getStorage('entity_view_mode')->load($this->entityTypeId . '.' . $this->options['view_mode']);
     if ($view_mode) {
         $dependencies[$view_mode->getConfigDependencyKey()][] = $view_mode->getConfigDependencyName();
     }
     return $dependencies;
 }
コード例 #3
0
ファイル: Fields.php プロジェクト: aWEBoLabs/taxi
 /**
  * Provide a form for setting options.
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $options = $this->displayHandler->getFieldLabels();
     if (empty($this->options['inline'])) {
         $this->options['inline'] = array();
     }
     $form['default_field_elements'] = array('#type' => 'checkbox', '#title' => $this->t('Provide default field wrapper elements'), '#default_value' => $this->options['default_field_elements'], '#description' => $this->t('If not checked, fields that are not configured to customize their HTML elements will get no wrappers at all for their field, label and field + label wrappers. You can use this to quickly reduce the amount of markup the view provides by default, at the cost of making it more difficult to apply CSS.'));
     $form['inline'] = array('#type' => 'checkboxes', '#title' => $this->t('Inline fields'), '#options' => $options, '#default_value' => $this->options['inline'], '#description' => $this->t('Inline fields will be displayed next to each other rather than one after another. Note that some fields will ignore this if they are block elements, particularly body fields and other formatted HTML.'), '#states' => array('visible' => array(':input[name="row_options[default_field_elements]"]' => array('checked' => TRUE))));
     $form['separator'] = array('#title' => $this->t('Separator'), '#type' => 'textfield', '#size' => 10, '#default_value' => isset($this->options['separator']) ? $this->options['separator'] : '', '#description' => $this->t('The separator may be placed between inline fields to keep them from squishing up next to each other. You can use HTML in this field.'), '#states' => array('visible' => array(':input[name="row_options[default_field_elements]"]' => array('checked' => TRUE))));
     $form['hide_empty'] = array('#type' => 'checkbox', '#title' => $this->t('Hide empty fields'), '#default_value' => $this->options['hide_empty'], '#description' => $this->t('Do not display fields, labels or markup for fields that are empty.'));
 }
コード例 #4
0
 /**
  * Overrides \Drupal\views\Plugin\views\row\RowPluginBase::buildOptionsForm().
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['field_options'] = array('#type' => 'table', '#header' => array(t('Field'), $this->t('Alias'), $this->t('Raw output')), '#empty' => $this->t('You have no fields. Add some to your view.'), '#tree' => TRUE);
     $options = $this->options['field_options'];
     if ($fields = $this->view->display_handler->getOption('fields')) {
         foreach ($fields as $id => $field) {
             $form['field_options'][$id]['field'] = array('#markup' => $id);
             $form['field_options'][$id]['alias'] = array('#title' => $this->t('Alias for @id', array('@id' => $id)), '#title_display' => 'invisible', '#type' => 'textfield', '#default_value' => isset($options[$id]['alias']) ? $options[$id]['alias'] : '', '#element_validate' => array(array($this, 'validateAliasName')));
             $form['field_options'][$id]['raw_output'] = array('#title' => $this->t('Raw output for @id', array('@id' => $id)), '#title_display' => 'invisible', '#type' => 'checkbox', '#default_value' => isset($options[$id]['raw_output']) ? $options[$id]['raw_output'] : '');
         }
     }
 }
コード例 #5
0
 public function validate()
 {
     $errors = parent::validate();
     $required_options = array('title_field', 'link_field', 'description_field', 'creator_field', 'date_field');
     foreach ($required_options as $required_option) {
         if (empty($this->options[$required_option])) {
             $errors[] = $this->t('Row style plugin requires specifying which views fields to use for RSS item.');
             break;
         }
     }
     // Once more for guid.
     if (empty($this->options['guid_field_options']['guid_field'])) {
         $errors[] = $this->t('Row style plugin requires specifying which views fields to use for RSS item.');
     }
     return $errors;
 }
コード例 #6
0
ファイル: OpmlFields.php プロジェクト: HakS/drupal8_training
 /**
  * {@inheritdoc}
  */
 public function validate()
 {
     $errors = parent::validate();
     if (empty($this->options['text_field'])) {
         $errors[] = $this->t('Row style plugin requires specifying which views field to use for OPML text attribute.');
     }
     if (!empty($this->options['type_field'])) {
         if ($this->options['type_field'] == 'rss') {
             if (empty($this->options['xml_url_field'])) {
                 $errors[] = $this->t('Row style plugin requires specifying which views field to use for XML URL attribute.');
             }
         } elseif (in_array($this->options['type_field'], array('link', 'include'))) {
             if (empty($this->options['url_field'])) {
                 $errors[] = $this->t('Row style plugin requires specifying which views field to use for URL attribute.');
             }
         }
     }
     return $errors;
 }
コード例 #7
0
 /**
  * {@inheritdoc}
  */
 public function validate()
 {
     $errors = parent::validate();
     // @todo Add validation.
     return $errors;
 }
コード例 #8
0
ファイル: Rss.php プロジェクト: alnutile/drunatra
 public function buildOptionsForm(&$form, &$form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['view_mode'] = array('#type' => 'select', '#title' => t('Display type'), '#options' => $this->options_form_summary_options(), '#default_value' => $this->options['view_mode']);
     $form['links'] = array('#type' => 'checkbox', '#title' => t('Display links'), '#default_value' => $this->options['links']);
 }
コード例 #9
0
ファイル: Rss.php プロジェクト: anatalsceo/en-classe
 /**
  * {@inheritdoc}
  */
 protected function defineOptions()
 {
     $options = parent::defineOptions();
     $options['view_mode'] = array('default' => 'default');
     return $options;
 }
コード例 #10
0
ファイル: SearchRow.php プロジェクト: alnutile/drunatra
 /**
  * {@inheritdoc}
  */
 protected function defineOptions()
 {
     $options = parent::defineOptions();
     $options['score'] = array('default' => TRUE, 'bool' => TRUE);
     return $options;
 }
コード例 #11
0
ファイル: DataEntityRow.php プロジェクト: eigentor/tommiblog
 /**
  * {@inheritdoc}
  */
 public function query()
 {
     parent::query();
     $this->getEntityTranslationRenderer()->query($this->view->getQuery());
 }
コード例 #12
0
 /**
  * {@inheritdoc}
  */
 public function preRender($result)
 {
     parent::preRender($result);
     if ($result) {
         $this->getRenderer()->preRender($result);
     }
 }
コード例 #13
0
 /**
  * {@inheritdoc}
  */
 public function query()
 {
     parent::query();
     // @todo Find a better way to ensure that the item is loaded.
     $this->view->query->addField('_magic');
 }
コード例 #14
0
ファイル: Calendar.php プロジェクト: CIGIHub/bsia-drupal8
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['markup'] = ['#markup' => $this->t("The calendar row plugin will format view results as calendar items. Make sure this display has a 'Calendar' format and uses a 'Date' contextual filter, or this plugin will not work correctly.")];
     $form['colors'] = ['#type' => 'fieldset', '#title' => $this->t('Legend Colors'), '#description' => $this->t('Set a hex color value (like #ffffff) to use in the calendar legend for each content type. Items with empty values will have no stripe in the calendar and will not be added to the legend.')];
     $options = [];
     // @todo Allow strip options for any bundes of any entity type
     if ($this->view->getBaseTables()['node_field_data']) {
         $options['type'] = $this->t('Based on Content Type');
     }
     if (\Drupal::moduleHandler()->moduleExists('taxonomy')) {
         $options['taxonomy'] = $this->t('Based on Taxonomy');
     }
     // If no option is available, stop here.
     if (empty($options)) {
         return;
     }
     $form['colors']['legend'] = ['#title' => $this->t('Stripes'), '#description' => $this->t('Add stripes to calendar items.'), '#type' => 'select', '#options' => $options, '#empty_value' => (string) $this->t('None'), '#default_value' => $this->options['colors']['legend']];
     if ($this->view->getBaseTables()['node_field_data']) {
         $colors = $this->options['colors']['calendar_colors_type'];
         $type_names = node_type_get_names();
         foreach ($type_names as $key => $name) {
             $form['colors']['calendar_colors_type'][$key] = ['#title' => $name, '#default_value' => isset($colors[$key]) ? $colors[$key] : CALENDAR_EMPTY_STRIPE, '#dependency' => ['edit-row-options-colors-legend' => ['type']], '#type' => 'textfield', '#size' => 7, '#maxlength' => 7, '#element_validate' => [[$this, 'validateHexColor']], '#prefix' => '<div class="calendar-colorpicker-wrapper">', '#suffix' => '<div class="calendar-colorpicker"></div></div>', '#attributes' => ['class' => ['edit-calendar-colorpicker']], '#attached' => ['library' => ['calendar/calendar.colorpicker']]] + $this->visibleOnLegendState('type');
         }
     }
     if (\Drupal::moduleHandler()->moduleExists('taxonomy')) {
         // Get the display's field names of taxonomy fields.
         $vocabulary_field_options = [];
         $fields = $this->displayHandler->getOption('fields');
         foreach ($fields as $name => $field_info) {
             // Select the proper field type.
             if ($this->isTermReferenceField($field_info, $this->fieldManager)) {
                 $vocabulary_field_options[$name] = $field_info['label'] ?: $name;
             }
         }
         if (empty($vocabulary_field_options)) {
             return;
         }
         $form['colors']['taxonomy_field'] = ['#title' => t('Term field'), '#type' => !empty($vocabulary_field_options) ? 'select' : 'hidden', '#default_value' => $this->options['colors']['taxonomy_field'], '#empty_value' => (string) $this->t('None'), '#description' => $this->t("Select the taxonomy term field to use when setting stripe colors. This works best for vocabularies with only a limited number of possible terms."), '#options' => $vocabulary_field_options, '#dependency' => ['edit-row-options-colors-legend' => ['taxonomy']]] + $this->visibleOnLegendState('taxonomy');
         if (empty($vocabulary_field_options)) {
             $form['colors']['taxonomy_field']['#options'] = ['' => ''];
             $form['colors']['taxonomy_field']['#suffix'] = $this->t('You must add a term field to this view to use taxonomy stripe values. This works best for vocabularies with only a limited number of possible terms.');
         }
         // Get the Vocabulary names.
         $vocab_vids = [];
         foreach ($vocabulary_field_options as $field_name => $label) {
             // @todo Provide storage manager via Dependency Injection
             $field_config = \Drupal::entityManager()->getStorage('field_config')->loadByProperties(['field_name' => $field_name]);
             // @TODO refactor
             reset($field_config);
             $key = key($field_config);
             $data = \Drupal::config('field.field.' . $field_config[$key]->getOriginalId())->getRawData();
             if ($target_bundles = $data['settings']['handler_settings']['target_bundles']) {
                 // Fields must target bundles set.
                 reset($target_bundles);
                 $vocab_vids[$field_name] = key($target_bundles);
             }
         }
         if (empty($vocab_vids)) {
             return;
         }
         $this->options['colors']['calendar_colors_vocabulary'] = $vocab_vids;
         $form['colors']['calendar_colors_vocabulary'] = ['#title' => t('Vocabulary Legend Types'), '#type' => 'value', '#value' => $vocab_vids] + $this->visibleOnLegendState('taxonomy');
         // Get the Vocabulary term id's and map to colors.
         // @todo Add labels for each Vocabulary.
         $term_colors = $this->options['colors']['calendar_colors_taxonomy'];
         foreach ($vocab_vids as $field_name => $vid) {
             $vocab = \Drupal::entityManager()->getStorage("taxonomy_term")->loadTree($vid);
             foreach ($vocab as $key => $term) {
                 $form['colors']['calendar_colors_taxonomy'][$term->tid] = ['#title' => $this->t($term->name), '#default_value' => isset($term_colors[$term->tid]) ? $term_colors[$term->tid] : CALENDAR_EMPTY_STRIPE, '#access' => !empty($vocabulary_field_options), '#dependency_count' => 2, '#dependency' => ['edit-row-options-colors-legend' => ['taxonomy'], 'edit-row-options-colors-taxonomy-field' => [$field_name]], '#type' => 'textfield', '#size' => 7, '#maxlength' => 7, '#element_validate' => [[$this, 'validateHexColor']], '#prefix' => '<div class="calendar-colorpicker-wrapper">', '#suffix' => '<div class="calendar-colorpicker"></div></div>', '#attributes' => ['class' => ['edit-calendar-colorpicker']], '#attached' => ['library' => ['calendar/calendar.colorpicker']]] + $this->visibleOnLegendState('taxonomy');
             }
         }
     }
 }
コード例 #15
0
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['view_mode'] = array('#type' => 'select', '#title' => $this->t('Display type'), '#options' => $this->buildOptionsForm_summary_options(), '#default_value' => $this->options['view_mode']);
 }
コード例 #16
0
ファイル: RowTest.php プロジェクト: alnutile/drunatra
 /**
  * Overrides Drupal\views\Plugin\views\row\RowPluginBase::buildOptionsForm().
  */
 public function buildOptionsForm(&$form, &$form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['test_option'] = array('#title' => t('Test option'), '#type' => 'textfield', '#description' => t('This is a textfield for test_option.'), '#default_value' => $this->options['test_option']);
 }
コード例 #17
0
ファイル: SearchApiRow.php プロジェクト: curveagency/intranet
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     /** @var \Drupal\search_api\Datasource\DatasourceInterface $datasource */
     foreach ($this->index->getDatasources() as $datasource_id => $datasource) {
         $datasource_label = $datasource->label();
         $bundles = $datasource->getBundles();
         if (!$datasource->getViewModes()) {
             $form['view_modes'][$datasource_id] = array('#type' => 'item', '#title' => $this->t('Default View mode for datasource %name', array('%name' => $datasource_label)), '#description' => $this->t("This datasource doesn't have any view modes available. It is therefore not possible to display results of this datasource using this row plugin."));
             continue;
         }
         foreach ($bundles as $bundle_id => $bundle_label) {
             $title = $this->t('View mode for datasource %datasource, bundle %bundle', array('%datasource' => $datasource_label, '%bundle' => $bundle_label));
             $view_modes = $datasource->getViewModes($bundle_id);
             if (!$view_modes) {
                 $form['view_modes'][$datasource_id][$bundle_id] = array('#type' => 'item', '#title' => $title, '#description' => $this->t("This bundle doesn't have any view modes available. It is therefore not possible to display results of this bundle using this row plugin."));
                 continue;
             }
             $form['view_modes'][$datasource_id][$bundle_id] = array('#type' => 'select', '#options' => $view_modes, '#title' => $title, '#default_value' => key($view_modes));
             if (isset($this->options['view_modes'][$datasource_id][$bundle_id])) {
                 $form['view_modes'][$datasource_id][$bundle_id]['#default_value'] = $this->options['view_modes'][$datasource_id][$bundle_id];
             }
         }
     }
 }