コード例 #1
0
ファイル: jcarousel.php プロジェクト: andypost/jcaurucel
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     // Build the list of skins as options.
     $skins = $this->getSkins();
     foreach (jcarousel_skins() as $key => $skin) {
         $skins[$key] = $skin['title'];
     }
     $skins[''] = t('None');
     // Number of options to provide in count-based options.
     $start_range = range(-10, 10);
     $range = array_combine($start_range, $start_range);
     // Remove '0'.
     unset($range[0]);
     $auto_range = array('' => t('Auto')) + array_combine(range(1, 10), range(1, 10));
     $form['description'] = array('#type' => 'markup', '#value' => '<div class="messages">' . t('The jCarousel style is affected by several other settings within the display. Enable the "Use AJAX" option on your display to have items loaded dynamically. The "Items to display" option will determine how many items are preloaded into the carousel on each AJAX request. Non-AJAX carousels will contain the total number of items set in the "Items to display" option. Carousels may not be used with the "Use pager" option.') . '</div>');
     $form['wrap'] = array('#type' => 'select', '#title' => t('Wrap content'), '#default_value' => $this->options['wrap'], '#description' => t('Specifies whether to wrap at the first/last item (or both) and jump back to the start/end.'), '#options' => array(0 => t('Disabled'), 'circular' => t('Circular'), 'both' => t('Both'), 'last' => t('Last'), 'first' => t('First')));
     $form['skin'] = array('#type' => 'select', '#title' => t('Skin'), '#default_value' => $this->options['skin'], '#options' => $skins, '#description' => t('Skins may be provided by other modules. Set to "None" if your theme includes carousel theming directly in style.css or another stylesheet. "None" does not include any built-in navigation, arrows, or positioning at all.'));
     $form['responsive'] = array('#type' => 'checkbox', '#title' => t('Responsive (number of items)'), '#default_value' => $this->options['responsive'], '#description' => t('Select this option to have the carousel automatically adjust the number of visible items and the number of items to scroll at a time based on the available width.') . ' <strong>' . t('Changing this option will override the "Visible" and "Scroll" options and set carousel orientation to "horizontal".') . '</strong>');
     $form['visible'] = array('#type' => 'select', '#title' => t('Number of visible items'), '#options' => $auto_range, '#default_value' => $this->options['visible'], '#description' => t('Set an exact number of items to show at a time. It is recommended to leave set this to "auto", in which the number of items will be determined automatically by the space available to the carousel.') . ' <strong>' . t('Changing this option will override "width" properties set in your CSS.') . '</strong>');
     $form['scroll'] = array('#type' => 'select', '#title' => t('Scroll'), '#description' => t('The number of items to scroll at a time. The "auto" setting scrolls all the visible items.'), '#options' => $auto_range, '#default_value' => $this->options['scroll']);
     $form['auto'] = array('#type' => 'textfield', '#title' => t('Auto-scroll after'), '#size' => 4, '#maxlength' => 4, '#default_value' => $this->options['auto'], '#field_suffix' => ' ' . t('seconds'), '#description' => t('Specifies how many seconds to periodically auto-scroll the content. If set to 0 (default) then autoscrolling is turned off.'));
     $form['navigation'] = array('#type' => 'select', '#title' => t('Enable navigation'), '#options' => array('' => t('None'), 'before' => t('Before'), 'after' => t('After')), '#default_value' => $this->options['navigation'], '#description' => t('Enable a clickable navigation list to jump straight to a given page.'));
     $form['ajax'] = array('#type' => 'checkbox', '#title' => t('AJAX load pages'), '#default_value' => $this->options['ajax'], '#description' => t('The number of items set in the pager settings will be preloaded. All additional pages will be loaded by AJAX as needed.'));
     $form['advanced'] = array('#type' => 'fieldset', '#title' => t('Advanced'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#parents' => array('style_options'));
     $form['advanced']['animation'] = array('#type' => 'textfield', '#title' => t('Animation speed'), '#size' => 10, '#maxlength' => 10, '#default_value' => $this->options['animation'], '#description' => t('The speed of the scroll animation as string in jQuery terms ("slow"  or "fast") or milliseconds as integer (See <a href="http://api.jquery.com/animate/">jQuery Documentation</a>).'));
     $form['advanced']['easing'] = array('#type' => 'textfield', '#title' => t('Easing effect'), '#size' => 10, '#maxlength' => 128, '#default_value' => $this->options['easing'], '#description' => t('The name of the easing effect that you want to use such as "swing" (the default) or "linear". See list of options in the <a href="http://api.jquery.com/animate/">jQuery Documentation</a>.'));
     $form['advanced']['start'] = array('#type' => 'select', '#title' => t('Start position'), '#description' => t('The item that will be shown as the first item in the list upon loading. Useful for starting a list in the middle of a set. A negative value allows choosing an item in the end, e.g. -1 is the last item.'), '#options' => $range, '#default_value' => $this->options['start']);
     $form['advanced']['autoPause'] = array('#type' => 'checkbox', '#title' => t('Pause auto-scroll on hover'), '#description' => t('If auto-scrolling, pause the carousel when the user hovers the mouse over an item.'), '#default_value' => $this->options['autoPause']);
     $form['advanced']['vertical'] = array('#type' => 'checkbox', '#title' => t('Vertical'), '#description' => t('Specifies wether the carousel appears in horizontal or vertical orientation. Changes the carousel from a left/right style to a up/down style carousel. Defaults to horizontal.'), '#default_value' => $this->options['vertical']);
 }
コード例 #2
0
ファイル: HtmlList.php プロジェクト: aWEBoLabs/taxi
 /**
  * Render the given style.
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['type'] = array('#type' => 'radios', '#title' => $this->t('List type'), '#options' => array('ul' => $this->t('Unordered list'), 'ol' => $this->t('Ordered list')), '#default_value' => $this->options['type']);
     $form['wrapper_class'] = array('#title' => $this->t('Wrapper class'), '#description' => $this->t('The class to provide on the wrapper, outside the list.'), '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['wrapper_class']);
     $form['class'] = array('#title' => $this->t('List class'), '#description' => $this->t('The class to provide on the list element itself.'), '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['class']);
 }
コード例 #3
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['grid_style'] = array('#prefix' => '<h4>Grid Settings</h4>', '#type' => 'select', '#title' => t('Mode'), '#description' => t('Choose grid style:'), '#options' => array('classic' => t('Classic Grid'), 'masonry' => t('Masonry Simple'), 'masonry_resize' => t('Masonry Resize')), '#default_value' => $this->options['grid_style'], '#attributes' => array('class' => array('grid-style')));
     $field_options = array();
     $fields = \Drupal::entityManager()->getFieldMapByFieldType('image');
     foreach ($fields as $field) {
         foreach ($field as $key => $value) {
             $field_options[$key] = $key;
         }
     }
     $form['masonry_background'] = array('#type' => 'select', '#title' => t('Image'), '#options' => $field_options, '#default_value' => $this->options['masonry_background'], '#states' => array('visible' => array('.grid-style' => array('value' => 'masonry_resize'))));
     $form['grid_ratio'] = array('#type' => 'textfield', '#title' => t('Ratio'), '#description' => t('The ratio image'), '#default_value' => $this->options['grid_ratio'], '#states' => array('visible' => array('.grid-style' => array('value' => 'masonry_resize'))));
     $form['grid_cols_lg'] = array('#type' => 'select', '#title' => t('Large Desktop Items'), '#description' => t('Number of items on large desktop'), '#options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12), '#default_value' => $this->options['grid_cols_lg']);
     $form['grid_cols_md'] = array('#type' => 'select', '#title' => t('Desktop Items'), '#description' => t('Number of items on desktop'), '#options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12), '#default_value' => $this->options['grid_cols_md']);
     $form['grid_cols_sm'] = array('#type' => 'select', '#title' => t('Tablet Items'), '#description' => t('Number of items on tablet'), '#options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12), '#default_value' => $this->options['grid_cols_sm']);
     $form['grid_cols_xs'] = array('#type' => 'select', '#title' => t('Phone Items'), '#description' => t('Number of items on phone'), '#options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12), '#default_value' => $this->options['grid_cols_xs']);
     $form['grid_margin'] = array('#type' => 'textfield', '#title' => t('Margin'), '#description' => t('The spacing beetween items'), '#default_value' => $this->options['grid_margin'], '#field_suffix' => 'px');
     $form['grid_filter'] = array('#type' => 'select', '#title' => t('Use Filter'), '#options' => array(0 => t('No'), 1 => t('Yes')), '#description' => t('Filter items by taxonomy term'), '#default_value' => $this->options['grid_filter'], '#attributes' => array('class' => array('grid-filter-option')));
     $categories = array();
     $categories['select'] = t('Select');
     foreach (Vocabulary::loadMultiple() as $vocabulary) {
         $categories[$vocabulary->id()] = $vocabulary->get('name');
     }
     $form['grid_filter_vocabulary'] = array('#type' => 'select', '#title' => t('Filter Vocabulary'), '#options' => $categories, '#description' => t('Which taxonomy vocabulary do you want to use for the filter'), '#default_value' => $this->options['grid_filter_vocabulary'], '#states' => array('visible' => array('.grid-filter-option' => array('value' => 1))));
 }
コード例 #4
0
 /**
  * Builds the configuration form.
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $options = array('' => $this->t('- None -'));
     $field_labels = $this->displayHandler->getFieldLabels(TRUE);
     $options += $field_labels;
     $form['date_field'] = array('#type' => 'select', '#title' => $this->t('Date'), '#options' => $options, '#default_value' => $this->options['date_field'], '#description' => $this->t('The field name of the date field that will be used as the date on the timeline.'));
     $form['group_heading'] = array('#type' => 'select', '#title' => $this->t('Group heading'), '#options' => array('' => $this->t('No Heading'), 'century' => $this->t('Century'), 'date' => $this->t('Full Date'), 'format' => $this->t('Custom Format')), '#description' => $this->t('The type of date heading to add to the timeline. This heading will be inserted at the first spot where the value of the heading changes.'), '#default_value' => $this->options['group_heading']);
     $form['group_heading_format'] = array('#type' => 'textfield', '#title' => $this->t('Group heading format'), '#description' => $this->t("If 'Custom Format' was selected above, input the format string to use for the date heading, using the formats from http://php.net/manual/en/function.date.php. For instance, 'M Y' will display a heading over all items with the same month and year, formatted as 'Jan 2016'."), '#default_value' => $this->options['group_heading_format']);
 }
コード例 #5
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $options = array('' => $this->t('- None -'));
     $field_labels = $this->displayHandler->getFieldLabels(TRUE);
     $options += $field_labels;
     $grouping = $this->options['grouping'];
     $form['grouping'] = array('#type' => 'select', '#title' => $this->t('Grouping field Nr.@number'), '#options' => $options, '#default_value' => $grouping, '#description' => $this->t('You may optionally specify a field by which to group the records. Leave blank to not group.'));
     $a = '';
 }
コード例 #6
0
ファイル: FlexSlider.php プロジェクト: r-daneelolivaw/chalk
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['flexslider'] = array('#type' => 'fieldset', '#title' => $this->t('FlexSlider'));
     $form['flexslider']['optionset'] = array('#title' => t('Option set'), '#type' => 'select', '#options' => flexslider_optionset_list(), '#default_value' => $this->options['optionset']);
     $captionfield_options = array('' => $this->t('None'));
     foreach ($this->displayHandler->getHandlers('field') as $field => $handler) {
         $captionfield_options[$field] = $handler->adminLabel();
     }
     $form['flexslider']['captionfield'] = array('#type' => 'select', '#title' => $this->t('Caption Field'), '#description' => $this->t("Select a field to be used as the caption. This can also be set manually by adding the '.flex-caption' class to a field. Required to use thumbnail captions."), '#options' => $captionfield_options, '#default_value' => $this->options['captionfield']);
     $form['flexslider']['id'] = array('#type' => 'textfield', '#title' => $this->t('Element ID'), '#description' => $this->t("Manually define the FlexSlider container ID attribute <em>Ensure you don't display similar ID elements on the same page</em>."), '#size' => 40, '#maxlength' => 255, '#default_value' => $this->options['id']);
 }
コード例 #7
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['title_field'] = array('#type' => 'select', '#title' => $this->t('Title field'), '#options' => $this->displayHandler->getFieldLabels(TRUE), '#required' => TRUE, '#default_value' => $this->options['title_field'], '#description' => $this->t('Select the field that will be used as the title.'));
     $form['accordion_filter'] = array('#type' => 'select', '#title' => t('Use Filter'), '#options' => array(0 => t('No'), 1 => t('Yes')), '#description' => t('Filter items by taxonomy term'), '#default_value' => $this->options['accordion_filter'], '#attributes' => array('class' => array('accordion-filter-option')));
     $categories = array();
     $categories['select'] = t('Select');
     foreach (Vocabulary::loadMultiple() as $vocabulary) {
         $categories[$vocabulary->id()] = $vocabulary->get('name');
     }
     $form['accordion_filter_vocabulary'] = array('#type' => 'select', '#title' => t('Filter Vocabulary'), '#options' => $categories, '#description' => t('Which taxonomy vocabulary do you want to use for the filter'), '#default_value' => $this->options['accordion_filter_vocabulary'], '#states' => array('visible' => array('.accordion-filter-option' => array('value' => 1))));
 }
コード例 #8
0
ファイル: Owl.php プロジェクト: tabvn/owl
 /**
  * Render the given style.
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['items'] = array('#type' => 'number', '#title' => $this->t('Items'), '#description' => $this->t('Maximum amount of items displayed at a time with the widest browser width.'), '#default_value' => $this->options['items']);
     $form['itemsDesktop'] = array('#type' => 'textfield', '#title' => $this->t('Items Desktop'), '#description' => $this->t('This allows you to preset the number of slides visible with a particular browser width. The format is [x,y] whereby x=browser width and y=number of slides displayed. For example [1199,4] means that if(window<=1199){ show 4 slides per page}'), '#default_value' => $this->options['itemsDesktop']);
     $form['itemsDesktopSmall'] = array('#type' => 'textfield', '#title' => $this->t('Items Desktop Small'), '#description' => $this->t('Example: [979,3]'), '#default_value' => $this->options['itemsDesktopSmall']);
     $form['itemsTablet'] = array('#type' => 'textfield', '#title' => $this->t('Items Tablet'), '#description' => $this->t('Example: [768,2]'), '#default_value' => $this->options['itemsTablet']);
     $form['itemsMobile'] = array('#type' => 'textfield', '#title' => $this->t('Items Mobile'), '#description' => $this->t('Example: [479,1]'), '#default_value' => $this->options['itemsMobile']);
     $form['singleItem'] = array('#type' => 'checkbox', '#title' => $this->t('Single Item'), '#default_value' => $this->options['singleItem'], '#description' => $this->t('Display only one item.'));
     //itemsScaleUp
     $form['itemsScaleUp'] = array('#type' => 'checkbox', '#title' => $this->t('Items ScaleUp'), '#default_value' => $this->options['itemsScaleUp'], '#description' => $this->t('Option to not stretch items when it is less than the supplied items.'));
     //slideSpeed
     $form['slideSpeed'] = array('#type' => 'number', '#title' => $this->t('Slide Speed'), '#default_value' => $this->options['slideSpeed'], '#description' => $this->t('Slide speed in milliseconds.'));
     //paginationSpeed
     $form['paginationSpeed'] = array('#type' => 'number', '#title' => $this->t('Pagination Speed'), '#default_value' => $this->options['paginationSpeed'], '#description' => $this->t('Pagination speed in milliseconds.'));
     //rewindSpeed
     $form['rewindSpeed'] = array('#type' => 'number', '#title' => $this->t('Rewind Speed'), '#default_value' => $this->options['rewindSpeed'], '#description' => $this->t('Rewind speed in milliseconds.'));
     //autoPlay
     $form['autoPlay'] = array('#type' => 'checkbox', '#title' => $this->t('AutoPlay'), '#default_value' => $this->options['autoPlay']);
     //stopOnHover
     $form['stopOnHover'] = array('#type' => 'checkbox', '#title' => $this->t('Stop On Hover'), '#default_value' => $this->options['stopOnHover'], '#description' => $this->t('Stop autoplay on mouse hover.'));
     //navigation
     $form['navigation'] = array('#type' => 'checkbox', '#title' => $this->t('Navigation'), '#default_value' => $this->options['navigation'], '#description' => $this->t('Display "next" and "prev" buttons.'));
     //prevText
     $form['prevText'] = array('#type' => 'textfield', '#title' => $this->t('Prev Text'), '#default_value' => $this->options['prevText'], '#description' => $this->t('Text for navigation prev button'));
     //nextText
     $form['nextText'] = array('#type' => 'textfield', '#title' => $this->t('Next Text'), '#default_value' => $this->options['nextText'], '#description' => $this->t('Text for navigation next button'));
     //rewindNav
     $form['rewindNav'] = array('#type' => 'checkbox', '#title' => $this->t('Rewind Nav'), '#default_value' => $this->options['rewindNav'], '#description' => $this->t('Slide to first item.'));
     //scrollPerPage
     $form['scrollPerPage'] = array('#type' => 'checkbox', '#title' => $this->t('Scroll Per Page'), '#default_value' => $this->options['scrollPerPage'], '#description' => $this->t('Scroll per page not per item. This affect next/prev buttons and mouse/touch dragging.'));
     //pagination
     $form['pagination'] = array('#type' => 'checkbox', '#title' => $this->t('pagination'), '#default_value' => $this->options['pagination'], '#description' => $this->t('Show pagination.'));
     //paginationNumbers
     $form['paginationNumbers'] = array('#type' => 'checkbox', '#title' => $this->t('Pagination Numbers'), '#default_value' => $this->options['paginationNumbers'], '#description' => $this->t('Show numbers inside pagination buttons.'));
     //responsive
     $form['responsive'] = array('#type' => 'checkbox', '#title' => $this->t('Responsive'), '#default_value' => $this->options['responsive'], '#description' => $this->t('Uncheck to use Owl Carousel on desktop-only.'));
     //responsiveRefreshRate
     $form['responsiveRefreshRate'] = array('#type' => 'number', '#title' => $this->t('Responsive Refresh Rate'), '#default_value' => $this->options['responsiveRefreshRate'], '#description' => $this->t('Check window width changes every 200ms for responsive actions.'));
     //mouseDrag
     $form['mouseDrag'] = array('#type' => 'checkbox', '#title' => $this->t('Mouse Drag'), '#default_value' => $this->options['mouseDrag'], '#description' => $this->t('Turn off/on mouse events.'));
     //touchDrag
     $form['touchDrag'] = array('#type' => 'checkbox', '#title' => $this->t('Touch Drag'), '#default_value' => $this->options['touchDrag'], '#description' => $this->t('Turn off/on touch events.'));
     //transitionStyle
     $form['transitionStyle'] = array('#type' => 'select', '#options' => array('fade' => $this->t('Fade'), 'backSlide' => $this->t('Back Slide'), 'goDown' => $this->t('Go Down'), 'scaleUp' => $this->t('ScaleUp')), '#title' => $this->t('Transition Style'), '#default_value' => $this->options['transitionStyle'], '#description' => $this->t('Add CSS3 transition style. Works only with one item on screen.'));
 }
コード例 #9
0
ファイル: Grid.php プロジェクト: nstielau/drops-8
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['columns'] = array('#type' => 'number', '#title' => $this->t('Number of columns'), '#default_value' => $this->options['columns'], '#required' => TRUE, '#min' => 1);
     $form['automatic_width'] = array('#type' => 'checkbox', '#title' => $this->t('Automatic width'), '#description' => $this->t('The width of each column will be calculated automatically based on the number of columns provided. If additional classes are entered or a theme injects classes based on a grid system, disabling this option may prove beneficial.'), '#default_value' => $this->options['automatic_width']);
     $form['alignment'] = array('#type' => 'radios', '#title' => $this->t('Alignment'), '#options' => array('horizontal' => $this->t('Horizontal'), 'vertical' => $this->t('Vertical')), '#default_value' => $this->options['alignment'], '#description' => $this->t('Horizontal alignment will place items starting in the upper left and moving right. Vertical alignment will place items starting in the upper left and moving down.'));
     $form['col_class_default'] = array('#title' => $this->t('Default column classes'), '#description' => $this->t('Add the default views column classes like views-col, col-1 and clearfix to the output. 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.'), '#type' => 'checkbox', '#default_value' => $this->options['col_class_default']);
     $form['col_class_custom'] = array('#title' => $this->t('Custom column class'), '#description' => $this->t('Additional classes to provide on each column. Separated by a space.'), '#type' => 'textfield', '#default_value' => $this->options['col_class_custom']);
     if ($this->usesFields()) {
         $form['col_class_custom']['#description'] .= ' ' . $this->t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.');
     }
     $form['row_class_default'] = array('#title' => $this->t('Default row classes'), '#description' => $this->t('Adds the default views row classes like views-row, row-1 and clearfix to the output. 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.'), '#type' => 'checkbox', '#default_value' => $this->options['row_class_default']);
     $form['row_class_custom'] = array('#title' => $this->t('Custom row class'), '#description' => $this->t('Additional classes to provide on each row. Separated by a space.'), '#type' => 'textfield', '#default_value' => $this->options['row_class_custom']);
     if ($this->usesFields()) {
         $form['row_class_custom']['#description'] .= ' ' . $this->t('You may use field tokens from as per the "Replacement patterns" used in "Rewrite the output of this field" for all fields.');
     }
 }
コード例 #10
0
ファイル: Jssor.php プロジェクト: anarshi/recap
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['global'] = array('#type' => 'fieldset', '#title' => 'Global');
     $form['global']['autoplay'] = array('#type' => 'checkbox', '#title' => $this->t('Autoplay'), '#default_value' => isset($this->options['global']['autoplay']) ? $this->options['global']['autoplay'] : $this->options['autoplay'], '#description' => t('Enable to auto play.'));
     $form['global']['autoplayinterval'] = array('#type' => 'number', '#title' => $this->t('Autoplay interval'), '#attributes' => array('min' => 0, 'step' => 1, 'value' => isset($this->options['global']['autoplayinterval']) ? $this->options['global']['autoplayinterval'] : $this->options['autoplayinterval']), '#description' => t('Interval (in milliseconds) to go for next slide since the previous stopped.'), '#states' => array('visible' => array(':input[name="style_options[global][autoplay]"]' => array('checked' => TRUE))));
     $form['global']['autoplaysteps'] = array('#type' => 'number', '#title' => $this->t('Autoplay step'), '#attributes' => array('min' => 1, 'step' => 1, 'value' => isset($this->options['global']['autoplaysteps']) ? $this->options['global']['autoplaysteps'] : $this->options['autoplaysteps']), '#description' => t('Steps to go for each navigation request.'), '#states' => array('visible' => array(':input[name="style_options[global][autoplay]"]' => array('checked' => TRUE))));
     $form['global']['pauseonhover'] = array('#type' => 'select', '#title' => $this->t('Pause on hover'), '#description' => t('Whether to pause when mouse over if a slider is auto playing.'), '#default_value' => isset($this->options['global']['pauseonhover']) ? $this->options['global']['pauseonhover'] : $this->options['pauseonhover'], '#options' => array(0 => $this->t('No pause'), 1 => $this->t('Pause for desktop'), 2 => $this->t('Pause for touch device'), 3 => $this->t('Pause for desktop and touch device'), 4 => $this->t('Freeze for desktop'), 8 => $this->t('Freeze for touch device'), 12 => $this->t('Freeze for desktop and touch device')), '#states' => array('visible' => array(':input[name="style_options[global][autoplay]"]' => array('checked' => TRUE))));
     $form['global']['transition'] = array('#type' => 'select', '#title' => $this->t('Transition'), '#description' => t('Whether to pause when mouse over if a slider is auto playing.'), '#default_value' => isset($this->options['global']['transition']) ? $this->options['global']['transition'] : $this->options['transition'], '#options' => array(t('Twins Effects') => array('transition0001' => $this->t('Fade Twins'), 'transition0002' => $this->t('Rotate Overlap'), 'transition0003' => $this->t('Switch'), 'transition0004' => $this->t('Rotate Relay'), 'transition0005' => $this->t('Doors'), 'transition0006' => $this->t('Rotate in+ out-'), 'transition0007' => $this->t('Fly Twins'), 'transition0008' => $this->t('Rotate in- out+'), 'transition0009' => $this->t('Rotate Axis up overlap'), 'transition0010' => $this->t('Chess Replace TB'), 'transition0011' => $this->t('Chess Replace LR'), 'transition0012' => $this->t('Shift TB'), 'transition0013' => $this->t('Shift LR'), 'transition0014' => $this->t('Return TB'), 'transition0015' => $this->t('Return LR'), 'transition0016' => $this->t('Rotate Axis down'), 'transition0017' => $this->t('Extrude Replace')), t('Fade Effects') => array('transition0101' => $this->t('Fade'), 'transition0102' => $this->t('Fade in L'), 'transition0103' => $this->t('Fade in R')), t('Swing Outside Effects') => array('transition0201' => $this->t('Swing Outside in Stairs'), 'transition0202' => $this->t('Swing Outside in ZigZag'), 'transition0203' => $this->t('Swing Outside in Swirl'), 'transition0204' => $this->t('Swing Outside in Random'), 'transition0205' => $this->t('Swing Outside in Random Chess')), t('Swing Inside Effects') => array('transition0301' => $this->t('Swing Inside in Stairs'), 'transition0302' => $this->t('Swing Inside in ZigZag'), 'transition0303' => $this->t('Swing Inside in Swirl'), 'transition0304' => $this->t('Swing Inside in Random'), 'transition0305' => $this->t('Swing Inside in Random Chess')), t('Dodge Dance Outside Effects') => array('transition0401' => $this->t('Dodge Dance Outside in Stairs'), 'transition0402' => $this->t('Dodge Dance Outside in Swirl'), 'transition0403' => $this->t('Dodge Dance Outside in ZigZag'), 'transition0404' => $this->t('Dodge Dance Outside in Random'), 'transition0405' => $this->t('Dodge Dance Outside in Random Chess')), t('Dodge Dance Inside Effects') => array('transition0501' => $this->t('Dodge Dance Inside in Stairs'), 'transition0502' => $this->t('Dodge Dance Inside in Swirl'), 'transition0503' => $this->t('Dodge Dance Inside in ZigZag'), 'transition0504' => $this->t('Dodge Dance Inside in Random'), 'transition0505' => $this->t('Dodge Dance Inside in Random Chess')), t('Dodge Pet Outside Effects') => array('transition0601' => $this->t('Dodge Pet Outside in Stairs'), 'transition0602' => $this->t('Dodge Pet Outside in Swirl'), 'transition0603' => $this->t('Dodge Pet Outside in ZigZag'), 'transition0604' => $this->t('Dodge Pet Outside in Random'), 'transition0605' => $this->t('Dodge Pet Outside in Random Chess')), t('Dodge Pet Inside Effects') => array('transition0701' => $this->t('Dodge Pet Inside in Stairs'), 'transition0702' => $this->t('Dodge Pet Inside in Swirl'), 'transition0703' => $this->t('Dodge Pet Inside in ZigZag'), 'transition0704' => $this->t('Dodge Pet Inside in Random'), 'transition0705' => $this->t('Dodge Pet Inside in Random Chess')), t('Dodge Outside Effects') => array('transition0801' => $this->t('Dodge Outside out Stairs'), 'transition0802' => $this->t('Dodge Outside out Swirl'), 'transition0803' => $this->t('Dodge Outside out ZigZag'), 'transition0804' => $this->t('Dodge Outside out Random'), 'transition0805' => $this->t('Dodge Outside out Random Chess'), 'transition0806' => $this->t('Dodge Outside out Square'), 'transition0807' => $this->t('Dodge Outside in Stairs'), 'transition0808' => $this->t('Dodge Outside in Swirl'), 'transition0809' => $this->t('Dodge Outside in ZigZag'), 'transition0810' => $this->t('Dodge Outside in Random'), 'transition0811' => $this->t('Dodge Outside in Random Chess'), 'transition0812' => $this->t('Dodge Outside in Square')), t('Dodge Inside Effects') => array('transition0901' => $this->t('Dodge Inside out Stairs'), 'transition0902' => $this->t('Dodge Inside out Swirl'), 'transition0903' => $this->t('Dodge Inside out ZigZag'), 'transition0904' => $this->t('Dodge Inside out Random'), 'transition0905' => $this->t('Dodge Inside out Random Chess'), 'transition0906' => $this->t('Dodge Inside out Square'), 'transition0907' => $this->t('Dodge Inside in Stairs'), 'transition0908' => $this->t('Dodge Inside in Swirl'), 'transition0909' => $this->t('Dodge Inside in ZigZag'), 'transition0910' => $this->t('Dodge Inside in Random'), 'transition0911' => $this->t('Dodge Inside in Random Chess'), 'transition0912' => $this->t('Dodge Inside in Square')), t('Flutter Outside Effects') => array('transition1001' => $this->t('Flutter Outside in'), 'transition1002' => $this->t('Flutter Outside in Wind'), 'transition1003' => $this->t('Flutter Outside in Swirl'), 'transition1004' => $this->t('Flutter Outside in Column'), 'transition1005' => $this->t('Flutter Outside out'), 'transition1006' => $this->t('Flutter Outside out Wind'), 'transition1007' => $this->t('Flutter Outside out Swirl'), 'transition1008' => $this->t('Flutter Outside out Column')), t('Flutter Inside Effects') => array('transition1101' => $this->t('Flutter Inside in'), 'transition1102' => $this->t('Flutter Inside in Wind'), 'transition1103' => $this->t('Flutter Inside in Swirl'), 'transition1104' => $this->t('Flutter Inside in Column'), 'transition1105' => $this->t('Flutter Inside out'), 'transition1106' => $this->t('Flutter Inside out Wind'), 'transition1107' => $this->t('Flutter Inside out Swirl'), 'transition1108' => $this->t('Flutter Inside out Column')), t('Rotate Effects') => array('transition1201' => $this->t('Rotate VDouble+ in'), 'transition1202' => $this->t('Rotate HDouble+ in'), 'transition1203' => $this->t('Rotate VDouble- in'), 'transition1204' => $this->t('Rotate HDouble- in'), 'transition1205' => $this->t('Rotate VDouble+ out'), 'transition1206' => $this->t('Rotate HDouble+ out'), 'transition1207' => $this->t('Rotate VDouble- out'), 'transition1208' => $this->t('Rotate HDouble- out'), 'transition1209' => $this->t('Rotate VFork+ in'), 'transition1210' => $this->t('Rotate HFork+ in'), 'transition1211' => $this->t('Rotate VFork+ out'), 'transition1212' => $this->t('Rotate HFork+ out'), 'transition1213' => $this->t('Rotate Zoom+ in'), 'transition1214' => $this->t('Rotate Zoom+ in L'), 'transition1215' => $this->t('Rotate Zoom+ in R'), 'transition1216' => $this->t('Rotate Zoom+ in T'), 'transition1217' => $this->t('Rotate Zoom+ in B'), 'transition1218' => $this->t('Rotate Zoom+ in TL'), 'transition1219' => $this->t('Rotate Zoom+ in TR'), 'transition1220' => $this->t('Rotate Zoom+ in BL'), 'transition1221' => $this->t('Rotate Zoom+ in BR'), 'transition1222' => $this->t('Rotate Zoom+ out'), 'transition1223' => $this->t('Rotate Zoom+ out L'), 'transition1224' => $this->t('Rotate Zoom+ out R')), t('Zoom Effects') => array('transition1301' => $this->t('Zoom VDouble+ in'), 'transition1302' => $this->t('Zoom HDouble+ in'), 'transition1303' => $this->t('Zoom VDouble- in'), 'transition1304' => $this->t('Zoom HDouble- in'), 'transition1305' => $this->t('Zoom VDouble+ out'), 'transition1306' => $this->t('Zoom HDouble+ out'), 'transition1307' => $this->t('Zoom VDouble- out'), 'transition1308' => $this->t('Zoom HDouble- out'), 'transition1309' => $this->t('Zoom+ in'), 'transition1310' => $this->t('Zoom+ in L'), 'transition1311' => $this->t('Zoom+ in R'), 'transition1312' => $this->t('Zoom+ in T'), 'transition1313' => $this->t('Zoom+ in B'), 'transition1314' => $this->t('Zoom+ in TL'), 'transition1315' => $this->t('Zoom+ in TR'), 'transition1316' => $this->t('Zoom+ in BL'), 'transition1317' => $this->t('Zoom+ in BR'), 'transition1318' => $this->t('Zoom+ out'), 'transition1319' => $this->t('Zoom+ out L'), 'transition1320' => $this->t('Zoom+ out R')), t('Collapse Effects') => array('transition1401' => $this->t('Collapse Stairs')), t('Compound Effects') => array('transition1501' => $this->t('Clip &amp; Chess in')), t('Expand Effects') => array('transition1601' => $this->t('Expand Stairs')), t('Stripe Effects') => array('transition1701' => $this->t('Dominoes Stripe')), t('Wave out Effects') => array('transition1801' => $this->t('Wave out')), t('Wave in Effects') => array('transition1901' => $this->t('Wave in')), t('Jump out Effects') => array('transition2001' => $this->t('Jump out Straight'), 'transition2002' => $this->t('Jump out Swirl'), 'transition2003' => $this->t('Jump out ZigZag'), 'transition2004' => $this->t('Jump out Square'), 'transition2005' => $this->t('Jump out Square with Chess'), 'transition2006' => $this->t('Jump out Rectangle'), 'transition2007' => $this->t('Jump out Circle'), 'transition2008' => $this->t('Jump out Rectangle Cross')), t('Jump in Effects') => array('transition2101' => $this->t('Jump in Straight'), 'transition2101' => $this->t('Jump in Straight'), 'transition2102' => $this->t('Jump in Swirl'), 'transition2103' => $this->t('Jump in ZigZag'), 'transition2104' => $this->t('Jump in Square'), 'transition2105' => $this->t('Jump in Square with Chess'), 'transition2106' => $this->t('Jump in Rectangle'), 'transition2107' => $this->t('Jump in Circle'), 'transition2108' => $this->t('Jump in Rectangle Cross')), t('Parabola Effects') => array('transition2201' => $this->t('Parabola Swirl in'), 'transition2202' => $this->t('Parabola Swirl out'), 'transition2203' => $this->t('Parabola ZigZag in'), 'transition2204' => $this->t('Parabola ZigZag out'), 'transition2205' => $this->t('Parabola Stairs in'), 'transition2206' => $this->t('Parabola Stairs out')), t('Float Effects') => array('transition2301' => $this->t('Float Right Random'), 'transition2302' => $this->t('Float up Random'), 'transition2303' => $this->t('Float up Random with Chess'), 'transition2304' => $this->t('Float Right ZigZag'), 'transition2305' => $this->t('Float up ZigZag'), 'transition2306' => $this->t('Float up ZigZag with Chess'), 'transition2307' => $this->t('Float Right Swirl'), 'transition2308' => $this->t('Float up Swirl'), 'transition2309' => $this->t('Float up Swirl with Chess')), t('Fly Effects') => array('transition2401' => $this->t('Fly Right Random'), 'transition2402' => $this->t('Fly up Random'), 'transition2403' => $this->t('Fly up Random with Chess'), 'transition2404' => $this->t('Fly Right ZigZag'), 'transition2405' => $this->t('Fly up ZigZag'), 'transition2406' => $this->t('Fly up ZigZag with Chess'), 'transition2407' => $this->t('Fly Right Swirl'), 'transition2408' => $this->t('Fly up Swirl'), 'transition2409' => $this->t('Fly up Swirl with Chess')), t('Stone Effects') => array('transition2501' => $this->t('Slide Down'), 'transition2502' => $this->t('Slide Right'), 'transition2503' => $this->t('Bounce Down'), 'transition2504' => $this->t('Bounce Right'))), '#states' => array('visible' => array(':input[name="style_options[global][autoplay]"]' => array('checked' => TRUE))));
     $form['global']['arrownavigator'] = array('#type' => 'checkbox', '#title' => $this->t('Enable arrow navigator'), '#default_value' => isset($this->options['global']['arrownavigator']) ? $this->options['global']['arrownavigator'] : $this->options['arrownavigator']);
     $form['global']['bulletnavigator'] = array('#type' => 'checkbox', '#title' => $this->t('Enable bullet navigator'), '#default_value' => isset($this->options['global']['bulletnavigator']) ? $this->options['global']['bulletnavigator'] : $this->options['bulletnavigator']);
     // Arrow navigator.
     $form['arrownavigator'] = array('#type' => 'fieldset', '#title' => $this->t('Arrow navigator'), '#states' => array('visible' => array(':input[name="style_options[global][arrownavigator]"]' => array('checked' => TRUE))));
     $arrowskin = array();
     for ($i = 1; $i < 22; $i++) {
         $i = $i < 10 ? '0' . $i : $i;
         $arrowskin[$i] = $this->t('Arrow ') . $i;
     }
     $form['arrownavigator']['arrowskin'] = array('#type' => 'select', '#title' => $this->t('Skin'), '#default_value' => isset($this->options['arrownavigator']['arrowskin']) ? $this->options['arrownavigator']['arrowskin'] : $this->options['arrowskin'], '#options' => $arrowskin);
     $form['arrownavigator']['autocenter'] = array('#type' => 'select', '#title' => $this->t('Auto center'), '#description' => $this->t('Auto center arrows in parent container'), '#default_value' => isset($this->options['arrownavigator']['autocenter']) ? $this->options['arrownavigator']['autocenter'] : $this->options['autocenter'], '#options' => array(0 => $this->t('No'), 1 => $this->t('Horizontal'), 2 => $this->t('Vertical'), 3 => $this->t('Both')));
     $form['arrownavigator']['chancetoshow'] = array('#type' => 'select', '#title' => $this->t('Chance to show'), '#default_value' => isset($this->options['arrownavigator']['chancetoshow']) ? $this->options['arrownavigator']['chancetoshow'] : $this->options['chancetoshow'], '#options' => array(0 => $this->t('Never'), 1 => $this->t('Mouse Over'), 2 => $this->t('Always')));
     // Bullet navigator.
     $form['bulletnavigator'] = array('#type' => 'fieldset', '#title' => $this->t('Bullet navigator'), '#states' => array('visible' => array(':input[name="style_options[global][bulletnavigator]"]' => array('checked' => TRUE))));
     $bulletskin = array();
     for ($i = 1; $i < 22; $i++) {
         $i = $i < 10 ? '0' . $i : $i;
         $bulletskin[$i] = $this->t('Bullet ') . $i;
     }
     $form['bulletnavigator']['bulletskin'] = array('#type' => 'select', '#title' => $this->t('Skin'), '#default_value' => isset($this->options['bulletnavigator']['bulletskin']) ? $this->options['bulletnavigator']['bulletskin'] : $this->options['bulletskin'], '#options' => $bulletskin);
     $form['bulletnavigator']['autocenter'] = array('#type' => 'select', '#title' => $this->t('Auto center'), '#description' => $this->t('Auto center arrows in parent container'), '#default_value' => isset($this->options['bulletnavigator']['autocenter']) ? $this->options['bulletnavigator']['autocenter'] : $this->options['autocenter'], '#options' => array(0 => $this->t('No'), 1 => $this->t('Horizontal'), 2 => $this->t('Vertical'), 3 => $this->t('Both')));
     $form['bulletnavigator']['chancetoshow'] = array('#type' => 'select', '#title' => $this->t('Chance to show'), '#default_value' => isset($this->options['bulletnavigator']['chancetoshow']) ? $this->options['bulletnavigator']['chancetoshow'] : $this->options['chancetoshow'], '#options' => array(0 => $this->t('Never'), 1 => $this->t('Mouse Over'), 2 => $this->t('Always')));
     $form['bulletnavigator']['spacingx'] = array('#type' => 'number', '#title' => $this->t('Horizontal space'), '#attributes' => array('min' => 0, 'step' => 1, 'value' => isset($this->options['bulletnavigator']['spacingx']) ? $this->options['bulletnavigator']['spacingx'] : $this->options['spacingx']), '#description' => t('Horizontal space between each item in pixel.'));
     $form['bulletnavigator']['spacingy'] = array('#type' => 'number', '#title' => $this->t('Vertical space'), '#attributes' => array('min' => 0, 'step' => 1, 'value' => isset($this->options['bulletnavigator']['spacingy']) ? $this->options['bulletnavigator']['spacingy'] : $this->options['spacingy']), '#description' => t('Vertical space between each item in pixel.'));
     $form['bulletnavigator']['orientation'] = array('#type' => 'select', '#title' => $this->t('The orientation of the navigator'), '#default_value' => isset($this->options['bulletnavigator']['orientation']) ? $this->options['bulletnavigator']['orientation'] : $this->options['orientation'], '#options' => array(1 => $this->t('Horizontal'), 2 => $this->t('Vertical')));
     $form['bulletnavigator']['steps'] = array('#type' => 'number', '#title' => $this->t('Steps'), '#attributes' => array('min' => 1, 'step' => 1, 'value' => isset($this->options['bulletnavigator']['steps']) ? $this->options['bulletnavigator']['steps'] : $this->options['steps']), '#description' => t('Steps to go for each navigation request.'));
     $form['bulletnavigator']['lanes'] = array('#type' => 'number', '#title' => $this->t('Lanes'), '#attributes' => array('min' => 1, 'step' => 1, 'value' => isset($this->options['bulletnavigator']['lanes']) ? $this->options['bulletnavigator']['lanes'] : $this->options['lanes']), '#description' => t('Specify lanes to arrange items.'));
 }
コード例 #11
0
ファイル: Mapping.php プロジェクト: HakS/drupal8_training
 /**
  * Overrides Drupal\views\Plugin\views\style\StylePluginBase::buildOptionsForm().
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     // Get the mapping.
     $mapping = $this->defineMapping();
     // Restrict the list of defaults to the mapping, in case they have changed.
     $options = array_intersect_key($this->options['mapping'], $mapping);
     // Get the labels of the fields added to this display.
     $field_labels = $this->displayHandler->getFieldLabels();
     // Provide some default values.
     $defaults = array('#type' => 'select', '#required' => FALSE, '#multiple' => FALSE);
     // For each mapping, add a select element to the form.
     foreach ($options as $key => $value) {
         // If the field is optional, add a 'None' value to the top of the options.
         $field_options = array();
         $required = !empty($mapping[$key]['#required']);
         if (!$required && empty($mapping[$key]['#multiple'])) {
             $field_options = array('' => $this->t('- None -'));
         }
         $field_options += $field_labels;
         // Optionally filter the available fields.
         if (isset($mapping[$key]['#filter'])) {
             $this->view->initHandlers();
             $filter = $mapping[$key]['#filter'];
             $this::$filter($field_options);
             unset($mapping[$key]['#filter']);
         }
         // These values must always be set.
         $overrides = array('#options' => $field_options, '#default_value' => $options[$key]);
         // Optionally allow the select to be toggleable.
         if (!empty($mapping[$key]['#toggle'])) {
             $form['mapping']["toggle_{$key}"] = array('#type' => 'checkbox', '#title' => $this->t('Use a custom %field_name', array('%field_name' => strtolower($mapping[$key]['#title']))), '#default_value' => $this->options['mapping']["toggle_{$key}"]);
             $overrides['#states']['visible'][':input[name="style_options[mapping][' . "toggle_{$key}" . ']"]'] = array('checked' => TRUE);
         }
         $form['mapping'][$key] = $overrides + $mapping[$key] + $defaults;
     }
 }
コード例 #12
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['grid_padding'] = array('#type' => 'number', '#title' => $this->t('Padding'), '#size' => 2, '#description' => $this->t('The amount of padding in pixels in between grid items.'), '#default_value' => $this->options['grid_padding'], '#maxlength' => 2);
 }
コード例 #13
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['mode'] = array('#prefix' => '<h4>bxSlider Settings</h4>', '#type' => 'select', '#title' => t('Mode'), '#description' => t('Type of transition between slides'), '#options' => array('horizontal' => t('Horizontal'), 'vertical' => t('Vertical'), 'fade' => t('Fade')), '#default_value' => $this->options['mode']);
     $form['ticker'] = array('#type' => 'select', '#title' => t('Ticker Enabled'), '#description' => t('If yes, use slider in ticker mode (similar to a news ticker)'), '#options' => array(true => 'Yes', false => 'No'), '#default_value' => $this->options['ticker']);
     $form['tickerHover'] = array('#type' => 'select', '#title' => t('Ticker Hover'), '#description' => t('Ticker will pause when mouse hovers over slider. Note: this functionality does NOT work if using CSS transitions!'), '#options' => array(true => 'Yes', false => 'No'), '#default_value' => $this->options['tickerHover']);
     $form['speed'] = array('#type' => 'textfield', '#title' => t('Speed'), '#description' => t('Slide transition duration (in ms)'), '#default_value' => $this->options['speed']);
     $form['touchEnabled'] = array('#type' => 'select', '#title' => t('Touch Enabled'), '#description' => t('If yes, slider will allow touch swipe transitions'), '#options' => array(true => 'Yes', false => 'No'), '#default_value' => $this->options['touchEnabled']);
     $form['auto'] = array('#type' => 'select', '#title' => t('Auto'), '#description' => t('Slides will automatically transition.'), '#options' => array(true => 'Yes', false => 'No'), '#default_value' => $this->options['auto']);
     $form['pause'] = array('#type' => 'textfield', '#title' => t('Pause'), '#description' => t('The amount of time (in ms) between each auto transition.'), '#default_value' => $this->options['pause']);
     $form['infiniteloop'] = array('#type' => 'select', '#title' => t('Infinite'), '#description' => t('If true, clicking "Next" while on the last slide will transition to the first slide and vice-versa'), '#options' => array(true => t('Yes'), false => t('No')), '#default_value' => $this->options['infiniteloop']);
     $form['slidemargin'] = array('#type' => 'textfield', '#title' => t('Slide Margin'), '#description' => t('Margin between each slide'), '#default_value' => $this->options['slidemargin']);
     $form['startslide'] = array('#type' => 'textfield', '#title' => t('Start Slide'), '#description' => t('Starting slide index (zero-based)'), '#default_value' => $this->options['startslide']);
     $form['randomstart'] = array('#type' => 'select', '#title' => t('Random Start'), '#options' => array(true => t('Yes'), false => t('No')), '#description' => t('Start slider on a random slide'), '#default_value' => $this->options['randomstart']);
     $form['pager'] = array('#type' => 'select', '#title' => t('Show Pager'), '#description' => t('If yes, a pager will be added.'), '#options' => array(true => 'Yes', false => 'No'), '#default_value' => $this->options['pager']);
     $form['controls'] = array('#type' => 'select', '#title' => t('Show Controls'), '#description' => t('If yes, next/prev controls will be added.'), '#options' => array(true => 'Yes', false => 'No'), '#default_value' => $this->options['controls']);
     $form['nexttext'] = array('#type' => 'textfield', '#title' => t('Custom nextText'), '#description' => t('Custom text to be used for the "Next" control'), '#default_value' => $this->options['nexttext']);
     $form['prevtext'] = array('#type' => 'textfield', '#title' => t('Custom prevText'), '#description' => t('Custom text to be used for the "Prev" control'), '#default_value' => $this->options['prevtext']);
     $form['autoControls'] = array('#type' => 'select', '#title' => t('Show Auto Controls'), '#description' => t('If Yes, "Start" / "Stop" controls will be added. Note: this functionality work if auto is true!'), '#options' => array(true => 'Yes', false => 'No'), '#default_value' => $this->options['autoControls']);
     $form['moveslides'] = array('#type' => 'textfield', '#title' => t('Move Slides'), '#description' => t('The number of slides to move on transition. This value must be >= minSlides, and <= maxSlides. If zero (default), the number of fully-visible slides will be used.'), '#default_value' => $this->options['moveslides']);
     $form['lg_items'] = array('#type' => 'select', '#title' => t('Large Desktop Items'), '#description' => t('Number of items on large desktop'), '#options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12), '#default_value' => $this->options['lg_items']);
     $form['md_items'] = array('#type' => 'select', '#title' => t('Desktop Items'), '#description' => t('Number of items on desktop'), '#options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12), '#default_value' => $this->options['md_items']);
     $form['sm_items'] = array('#type' => 'select', '#title' => t('Tablet Items'), '#description' => t('Number of items on tablet'), '#options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12), '#default_value' => $this->options['sm_items']);
     $form['xs_items'] = array('#type' => 'select', '#title' => t('Phone Items'), '#description' => t('Number of items on phone'), '#options' => array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12), '#default_value' => $this->options['xs_items']);
 }
コード例 #14
0
ファイル: Serializer.php プロジェクト: nstielau/drops-8
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['formats'] = array('#type' => 'checkboxes', '#title' => $this->t('Accepted request formats'), '#description' => $this->t('Request formats that will be allowed in responses. If none are selected all formats will be allowed.'), '#options' => array_combine($this->formats, $this->formats), '#default_value' => $this->options['formats']);
 }
コード例 #15
0
ファイル: EntityReference.php プロジェクト: alnutile/drunatra
 /**
  * Overrides \Drupal\views\Plugin\views\style\StylePluginBase\StylePluginBase::buildOptionsForm().
  */
 public function buildOptionsForm(&$form, &$form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $options = $this->displayHandler->getFieldLabels(TRUE);
     $form['search_fields'] = array('#type' => 'checkboxes', '#title' => t('Search fields'), '#options' => $options, '#required' => TRUE, '#default_value' => $this->options['search_fields'], '#description' => t('Select the field(s) that will be searched when using the autocomplete widget.'), '#weight' => -3);
 }
コード例 #16
0
ファイル: Table.php プロジェクト: aWEBoLabs/taxi
 /**
  * Render the given style.
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $handlers = $this->displayHandler->getHandlers('field');
     if (empty($handlers)) {
         $form['error_markup'] = array('#markup' => '<div class="messages messages--error">' . $this->t('You need at least one field before you can configure your table settings') . '</div>');
         return;
     }
     $form['override'] = array('#type' => 'checkbox', '#title' => $this->t('Override normal sorting if click sorting is used'), '#default_value' => !empty($this->options['override']));
     $form['sticky'] = array('#type' => 'checkbox', '#title' => $this->t('Enable Drupal style "sticky" table headers (Javascript)'), '#default_value' => !empty($this->options['sticky']), '#description' => $this->t('(Sticky header effects will not be active for preview below, only on live output.)'));
     $form['caption'] = array('#type' => 'textfield', '#title' => $this->t('Caption for the table'), '#description' => $this->t('A title semantically associated with your table for increased accessibility.'), '#default_value' => $this->options['caption'], '#maxlength' => 255);
     $form['accessibility_details'] = array('#type' => 'details', '#title' => $this->t('Table details'));
     $form['summary'] = array('#title' => $this->t('Summary title'), '#type' => 'textfield', '#default_value' => $this->options['summary'], '#fieldset' => 'accessibility_details');
     $form['description'] = array('#title' => $this->t('Table description'), '#type' => 'textarea', '#description' => $this->t('Provide additional details about the table to increase accessibility.'), '#default_value' => $this->options['description'], '#states' => array('visible' => array('input[name="style_options[summary]"]' => array('filled' => TRUE))), '#fieldset' => 'accessibility_details');
     // Note: views UI registers this theme handler on our behalf. Your module
     // will have to register your theme handlers if you do stuff like this.
     $form['#theme'] = 'views_ui_style_plugin_table';
     $columns = $this->sanitizeColumns($this->options['columns']);
     // Create an array of allowed columns from the data we know:
     $field_names = $this->displayHandler->getFieldLabels();
     if (isset($this->options['default'])) {
         $default = $this->options['default'];
         if (!isset($columns[$default])) {
             $default = -1;
         }
     } else {
         $default = -1;
     }
     foreach ($columns as $field => $column) {
         $column_selector = ':input[name="style_options[columns][' . $field . ']"]';
         $form['columns'][$field] = array('#title' => $this->t('Columns for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'select', '#options' => $field_names, '#default_value' => $column);
         if ($handlers[$field]->clickSortable()) {
             $form['info'][$field]['sortable'] = array('#title' => $this->t('Sortable for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'checkbox', '#default_value' => !empty($this->options['info'][$field]['sortable']), '#states' => array('visible' => array($column_selector => array('value' => $field))));
             $form['info'][$field]['default_sort_order'] = array('#title' => $this->t('Default sort order for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'select', '#options' => array('asc' => $this->t('Ascending'), 'desc' => $this->t('Descending')), '#default_value' => !empty($this->options['info'][$field]['default_sort_order']) ? $this->options['info'][$field]['default_sort_order'] : 'asc', '#states' => array('visible' => array($column_selector => array('value' => $field), ':input[name="style_options[info][' . $field . '][sortable]"]' => array('checked' => TRUE))));
             // Provide an ID so we can have such things.
             $radio_id = Html::getUniqueId('edit-default-' . $field);
             $form['default'][$field] = array('#title' => $this->t('Default sort for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'radio', '#return_value' => $field, '#parents' => array('style_options', 'default'), '#id' => $radio_id, '#attributes' => array('id' => $radio_id), '#default_value' => $default, '#states' => array('visible' => array($column_selector => array('value' => $field))));
         }
         $form['info'][$field]['align'] = array('#title' => $this->t('Alignment for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'select', '#default_value' => !empty($this->options['info'][$field]['align']) ? $this->options['info'][$field]['align'] : '', '#options' => array('' => $this->t('None'), 'views-align-left' => $this->t('Left', array(), array('context' => 'Text alignment')), 'views-align-center' => $this->t('Center', array(), array('context' => 'Text alignment')), 'views-align-right' => $this->t('Right', array(), array('context' => 'Text alignment'))), '#states' => array('visible' => array($column_selector => array('value' => $field))));
         $form['info'][$field]['separator'] = array('#title' => $this->t('Separator for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'textfield', '#size' => 10, '#default_value' => isset($this->options['info'][$field]['separator']) ? $this->options['info'][$field]['separator'] : '', '#states' => array('visible' => array($column_selector => array('value' => $field))));
         $form['info'][$field]['empty_column'] = array('#title' => $this->t('Hide empty column for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'checkbox', '#default_value' => isset($this->options['info'][$field]['empty_column']) ? $this->options['info'][$field]['empty_column'] : FALSE, '#states' => array('visible' => array($column_selector => array('value' => $field))));
         $form['info'][$field]['responsive'] = array('#title' => $this->t('Responsive setting for @field', array('@field' => $field)), '#title_display' => 'invisible', '#type' => 'select', '#default_value' => isset($this->options['info'][$field]['responsive']) ? $this->options['info'][$field]['responsive'] : '', '#options' => array('' => $this->t('High'), RESPONSIVE_PRIORITY_MEDIUM => $this->t('Medium'), RESPONSIVE_PRIORITY_LOW => $this->t('Low')), '#states' => array('visible' => array($column_selector => array('value' => $field))));
         // markup for the field name
         $form['info'][$field]['name'] = array('#markup' => $field_names[$field]);
     }
     // Provide a radio for no default sort
     $form['default'][-1] = array('#title' => $this->t('No default sort'), '#title_display' => 'invisible', '#type' => 'radio', '#return_value' => -1, '#parents' => array('style_options', 'default'), '#id' => 'edit-default-0', '#default_value' => $default);
     $form['empty_table'] = array('#type' => 'checkbox', '#title' => $this->t('Show the empty text in the table'), '#default_value' => $this->options['empty_table'], '#description' => $this->t('Per default the table is hidden for an empty view. With this option it is possible to show an empty table with the text in it.'));
     $form['description_markup'] = array('#markup' => '<div class="js-form-item form-item description">' . $this->t('Place fields into columns; you may combine multiple fields into the same column. If you do, the separator in the column specified will be used to separate the fields. Check the sortable box to make that column click sortable, and check the default sort radio to determine which column will be sorted by default, if any. You may control column order and field labels in the fields section.') . '</div>');
 }
コード例 #17
0
ファイル: FullCalendar.php プロジェクト: anatalsceo/en-classe
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, &$form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     foreach ($this->pluginBag as $plugin) {
         $plugin->buildOptionsForm($form, $form_state);
     }
 }
コード例 #18
0
 /**
  * Overrides Drupal\views\Plugin\views\style\StylePluginBase::buildOptionsForm().
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['test_option'] = array('#title' => $this->t('Test option'), '#type' => 'textfield', '#description' => $this->t('This is a textfield for test_option.'), '#default_value' => $this->options['test_option']);
 }
コード例 #19
0
ファイル: Jssor.php プロジェクト: rafavergara/ddv8
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['global'] = array('#type' => 'fieldset', '#title' => 'Global');
     $form['global']['autoplay'] = array('#type' => 'checkbox', '#title' => $this->t('Autoplay'), '#default_value' => isset($this->options['global']['autoplay']) ? $this->options['global']['autoplay'] : $this->options['autoplay'], '#description' => t('Enable to auto play.'));
     $form['global']['arrownavigator'] = array('#type' => 'checkbox', '#title' => $this->t('Arrow navigator'), '#default_value' => isset($this->options['global']['arrownavigator']) ? $this->options['global']['arrownavigator'] : $this->options['arrownavigator'], '#description' => t('Enable arrow navigator.'));
     $form['global']['bulletnavigator'] = array('#type' => 'checkbox', '#title' => $this->t('Bullet navigator'), '#default_value' => isset($this->options['global']['bulletnavigator']) ? $this->options['global']['bulletnavigator'] : $this->options['bulletnavigator'], '#description' => t('Enable bullet navigator.'));
     // Slider.
     $form['general'] = array('#type' => 'fieldset', '#title' => $this->t('General'));
     $form['general']['slide_duration'] = array('#type' => 'number', '#title' => $this->t('Slide duration'), '#attributes' => array('min' => 0, 'step' => 1, 'value' => isset($this->options['general']['slide_duration']) ? $this->options['general']['slide_duration'] : $this->options['slide_duration']), '#description' => t('Specifies default duration (swipe) for slide in milliseconds.'));
     /*$form['general']['slide_spacing'] = array(
         '#type' => 'number',
         '#title' => $this->t('Slide spacing'),
         '#attributes' => array(
           'min' => 0,
           'step' => 1,
           'value' => (isset($this->options['general']['slide_spacing'])) ?
             $this->options['general']['slide_spacing'] : $this->options['slide_spacing'],
         ),
         '#description' => t('Space between each slide in pixels.'),
       );*/
     $form['general']['drag_orientation'] = array('#type' => 'select', '#title' => $this->t('Drag orientation'), '#description' => t('Orientation to drag slide.'), '#default_value' => isset($this->options['general']['drag_orientation']) ? $this->options['general']['drag_orientation'] : $this->options['drag_orientation'], '#options' => array(0 => $this->t('No drag'), 1 => $this->t('Horizontal'), 2 => $this->t('Vertical'), 3 => $this->t('Horizontal and vertical')));
     $form['general']['key_navigation'] = array('#type' => 'checkbox', '#title' => t('Key navigation'), '#default_value' => isset($this->options['general']['key_navigation']) ? $this->options['general']['key_navigation'] : $this->options['key_navigation'], '#description' => t('Allows keyboard (arrow key) navigation or not.'));
     // Autoplay.
     $form['autoplay'] = array('#type' => 'fieldset', '#title' => $this->t('Autoplay'), '#states' => array('visible' => array(':input[name="style_options[global][autoplay]"]' => array('checked' => TRUE))));
     $form['autoplay']['autoplayinterval'] = array('#type' => 'number', '#title' => $this->t('Autoplay interval'), '#attributes' => array('min' => 0, 'step' => 1, 'value' => isset($this->options['autoplay']['autoplayinterval']) ? $this->options['autoplay']['autoplayinterval'] : $this->options['autoplayinterval']), '#description' => t('Interval (in milliseconds) to go for next slide since the previous stopped.'));
     $form['autoplay']['autoplaysteps'] = array('#type' => 'number', '#title' => $this->t('Autoplay step'), '#attributes' => array('min' => 1, 'step' => 1, 'value' => isset($this->options['autoplay']['autoplaysteps']) ? $this->options['autoplay']['autoplaysteps'] : $this->options['autoplaysteps']), '#description' => t('Steps to go for each navigation request.'));
     $form['autoplay']['pauseonhover'] = array('#type' => 'select', '#title' => $this->t('Pause on hover'), '#description' => t('Whether to pause when mouse over if a slider is auto playing.'), '#default_value' => isset($this->options['autoplay']['pauseonhover']) ? $this->options['autoplay']['pauseonhover'] : $this->options['pauseonhover'], '#options' => array(0 => $this->t('No pause'), 1 => $this->t('Pause for desktop'), 2 => $this->t('Pause for touch device'), 3 => $this->t('Pause for desktop and touch device'), 4 => $this->t('Freeze for desktop'), 8 => $this->t('Freeze for touch device'), 12 => $this->t('Freeze for desktop and touch device')));
     $form['autoplay']['transition'] = ['#type' => 'select', '#title' => $this->t('Transition'), '#description' => t('Whether to pause when mouse over if a slider is auto playing.'), '#default_value' => isset($this->options['autoplay']['transition']) ? $this->options['autoplay']['transition'] : $this->options['transition'], '#options' => ['Twins Effects' => ['transition0000' => $this->t('Basic'), 'transition0001' => $this->t('Fade Twins'), 'transition0002' => $this->t('Rotate Overlap'), 'transition0003' => $this->t('Switch'), 'transition0004' => $this->t('Rotate Relay'), 'transition0005' => $this->t('Doors'), 'transition0006' => $this->t('Rotate in+ out-'), 'transition0007' => $this->t('Fly Twins'), 'transition0008' => $this->t('Rotate in- out+'), 'transition0009' => $this->t('Rotate Axis up overlap'), 'transition0010' => $this->t('Chess Replace TB'), 'transition0011' => $this->t('Chess Replace LR'), 'transition0012' => $this->t('Shift TB'), 'transition0013' => $this->t('Shift LR'), 'transition0014' => $this->t('Return TB'), 'transition0015' => $this->t('Return LR'), 'transition0016' => $this->t('Rotate Axis down'), 'transition0017' => $this->t('Extrude Replace')], 'Fade Effects' => ['transition0101' => $this->t('Fade'), 'transition0102' => $this->t('Fade in L'), 'transition0103' => $this->t('Fade in R'), 'transition0104' => $this->t('Fade in T'), 'transition0105' => $this->t('Fade in B'), 'transition0106' => $this->t('Fade in LR'), 'transition0107' => $this->t('Fade in LR Chess'), 'transition0108' => $this->t('Fade in TB'), 'transition0109' => $this->t('Fade in TB Chess'), 'transition0110' => $this->t('Fade in Corners'), 'transition0111' => $this->t('Fade out L'), 'transition0112' => $this->t('Fade out R'), 'transition0113' => $this->t('Fade out T'), 'transition0114' => $this->t('Fade out B'), 'transition0115' => $this->t('Fade out LR'), 'transition0116' => $this->t('Fade out LR Chess'), 'transition0117' => $this->t('Fade out TB'), 'transition0118' => $this->t('Fade out TB Chess'), 'transition0119' => $this->t('Fade out Corners'), 'transition0120' => $this->t('Fade Fly in L'), 'transition0121' => $this->t('Fade Fly in R'), 'transition0122' => $this->t('Fade Fly in T'), 'transition0123' => $this->t('Fade Fly in B'), 'transition0124' => $this->t('Fade Fly in LR'), 'transition0125' => $this->t('Fade Fly in LR Chess'), 'transition0126' => $this->t('Fade Fly in TB'), 'transition0127' => $this->t('Fade Fly in TB Chess'), 'transition0128' => $this->t('Fade Fly in Corners'), 'transition0129' => $this->t('Fade Fly out L'), 'transition0130' => $this->t('Fade Fly out R'), 'transition0131' => $this->t('Fade Fly out T'), 'transition0132' => $this->t('Fade Fly out B'), 'transition0133' => $this->t('Fade Fly out LR'), 'transition0134' => $this->t('Fade Fly out LR Chess'), 'transition0135' => $this->t('Fade Fly out TB'), 'transition0136' => $this->t('Fade Fly out TB Chess'), 'transition0137' => $this->t('Fade Fly out Corners'), 'transition0138' => $this->t('Fade Clip in H'), 'transition0139' => $this->t('Fade Clip in V'), 'transition0140' => $this->t('Fade Clip out H'), 'transition0141' => $this->t('Fade Clip out V'), 'transition0142' => $this->t('Fade Stairs'), 'transition0143' => $this->t('Fade Random'), 'transition0144' => $this->t('Fade Swirl'), 'transition0145' => $this->t('Fade ZigZag')], 'Swing Outside Effects' => ['transition0201' => $this->t('Swing Outside in Stairs'), 'transition0202' => $this->t('Swing Outside in ZigZag'), 'transition0203' => $this->t('Swing Outside in Swirl'), 'transition0204' => $this->t('Swing Outside in Random'), 'transition0205' => $this->t('Swing Outside in Random Chess'), 'transition0206' => $this->t('Swing Outside in Square'), 'transition0207' => $this->t('Swing Outside out Stairs'), 'transition0208' => $this->t('Swing Outside out ZigZag'), 'transition0209' => $this->t('Swing Outside out Swirl'), 'transition0210' => $this->t('Swing Outside out Random'), 'transition0211' => $this->t('Swing Outside out Random Chess'), 'transition0212' => $this->t('Swing Outside out Square')], 'Swing Inside Effects' => ['transition0301' => $this->t('Swing Inside in Stairs'), 'transition0302' => $this->t('Swing Inside in ZigZag'), 'transition0303' => $this->t('Swing Inside in Swirl'), 'transition0304' => $this->t('Swing Inside in Random'), 'transition0305' => $this->t('Swing Inside in Random Chess'), 'transition0306' => $this->t('Swing Inside in Square'), 'transition0307' => $this->t('Swing Inside out ZigZag'), 'transition0308' => $this->t('Swing Inside out Swirl')], 'Dodge Dance Outside Effects' => ['transition0401' => $this->t('Dodge Dance Outside in Stairs'), 'transition0402' => $this->t('Dodge Dance Outside in Swirl'), 'transition0403' => $this->t('Dodge Dance Outside in ZigZag'), 'transition0404' => $this->t('Dodge Dance Outside in Random'), 'transition0405' => $this->t('Dodge Dance Outside in Random Chess'), 'transition0406' => $this->t('Dodge Dance Outside in Square'), 'transition0407' => $this->t('Dodge Dance Outside out Stairs'), 'transition0408' => $this->t('Dodge Dance Outside out Swirl'), 'transition0409' => $this->t('Dodge Dance Outside out ZigZag'), 'transition0410' => $this->t('Dodge Dance Outside out Random'), 'transition0411' => $this->t('Dodge Dance Outside out Random Chess'), 'transition0412' => $this->t('Dodge Dance Outside out Square')], 'Dodge Dance Inside Effects' => ['transition0501' => $this->t('Dodge Dance Inside in Stairs'), 'transition0502' => $this->t('Dodge Dance Inside in Swirl'), 'transition0503' => $this->t('Dodge Dance Inside in ZigZag'), 'transition0504' => $this->t('Dodge Dance Inside in Random'), 'transition0505' => $this->t('Dodge Dance Inside in Random Chess'), 'transition0506' => $this->t('Dodge Dance Inside in Square'), 'transition0507' => $this->t('Dodge Dance Inside out Stairs'), 'transition0508' => $this->t('Dodge Dance Inside out Swirl'), 'transition0509' => $this->t('Dodge Dance Inside out ZigZag'), 'transition0510' => $this->t('Dodge Dance Inside out Random'), 'transition0511' => $this->t('Dodge Dance Inside out Random Chess'), 'transition0512' => $this->t('Dodge Dance Inside out Square')], 'Dodge Pet Outside Effects' => ['transition0601' => $this->t('Dodge Pet Outside in Stairs'), 'transition0602' => $this->t('Dodge Pet Outside in Swirl'), 'transition0603' => $this->t('Dodge Pet Outside in ZigZag'), 'transition0604' => $this->t('Dodge Pet Outside in Random'), 'transition0605' => $this->t('Dodge Pet Outside in Random Chess'), 'transition0606' => $this->t('Dodge Pet Outside in Square'), 'transition0607' => $this->t('Dodge Pet Outside out Stairs'), 'transition0608' => $this->t('Dodge Pet Outside out Swirl'), 'transition0609' => $this->t('Dodge Pet Outside out ZigZag'), 'transition0610' => $this->t('Dodge Pet Outside out Random'), 'transition0611' => $this->t('Dodge Pet Outside out Random Chess'), 'transition0612' => $this->t('Dodge Pet Outside out Square')], 'Dodge Pet Inside Effects' => ['transition0701' => $this->t('Dodge Pet Inside in Stairs'), 'transition0702' => $this->t('Dodge Pet Inside in Swirl'), 'transition0703' => $this->t('Dodge Pet Inside in ZigZag'), 'transition0704' => $this->t('Dodge Pet Inside in Random'), 'transition0705' => $this->t('Dodge Pet Inside in Random Chess'), 'transition0706' => $this->t('Dodge Pet Inside in Square'), 'transition0707' => $this->t('Dodge Pet Inside out Stairs'), 'transition0708' => $this->t('Dodge Pet Inside out Swirl'), 'transition0709' => $this->t('Dodge Pet Inside out ZigZag'), 'transition0710' => $this->t('Dodge Pet Inside out Random'), 'transition0711' => $this->t('Dodge Pet Inside out Random Chess'), 'transition0712' => $this->t('Dodge Pet Inside out Square')], 'Dodge Outside Effects' => ['transition0801' => $this->t('Dodge Outside out Stairs'), 'transition0802' => $this->t('Dodge Outside out Swirl'), 'transition0803' => $this->t('Dodge Outside out ZigZag'), 'transition0804' => $this->t('Dodge Outside out Random'), 'transition0805' => $this->t('Dodge Outside out Random Chess'), 'transition0806' => $this->t('Dodge Outside out Square'), 'transition0807' => $this->t('Dodge Outside in Stairs'), 'transition0808' => $this->t('Dodge Outside in Swirl'), 'transition0809' => $this->t('Dodge Outside in ZigZag'), 'transition0810' => $this->t('Dodge Outside in Random'), 'transition0811' => $this->t('Dodge Outside in Random Chess'), 'transition0812' => $this->t('Dodge Outside in Square')], $this->t('Dodge Inside Effects') => ['transition0901' => $this->t('Dodge Inside out Stairs'), 'transition0902' => $this->t('Dodge Inside out Swirl'), 'transition0903' => $this->t('Dodge Inside out ZigZag'), 'transition0904' => $this->t('Dodge Inside out Random'), 'transition0905' => $this->t('Dodge Inside out Random Chess'), 'transition0906' => $this->t('Dodge Inside out Square'), 'transition0907' => $this->t('Dodge Inside in Stairs'), 'transition0908' => $this->t('Dodge Inside in Swirl'), 'transition0909' => $this->t('Dodge Inside in ZigZag'), 'transition0910' => $this->t('Dodge Inside in Random'), 'transition0911' => $this->t('Dodge Inside in Random Chess'), 'transition0912' => $this->t('Dodge Inside in Square'), 'transition0913' => $this->t('Dodge Inside in TL'), 'transition0914' => $this->t('Dodge Inside in TR'), 'transition0915' => $this->t('Dodge Inside in BL'), 'transition0916' => $this->t('Dodge Inside in BR'), 'transition0917' => $this->t('Dodge Inside out TL'), 'transition0918' => $this->t('Dodge Inside out TR'), 'transition0919' => $this->t('Dodge Inside out BL'), 'transition0920' => $this->t('Dodge Inside out BR')], 'Flutter Outside Effects' => ['transition1001' => $this->t('Flutter Outside in'), 'transition1002' => $this->t('Flutter Outside in Wind'), 'transition1003' => $this->t('Flutter Outside in Swirl'), 'transition1004' => $this->t('Flutter Outside in Column'), 'transition1005' => $this->t('Flutter Outside out'), 'transition1006' => $this->t('Flutter Outside out Wind'), 'transition1007' => $this->t('Flutter Outside out Swirl'), 'transition1008' => $this->t('Flutter Outside out Column')], 'Flutter Inside Effects' => ['transition1101' => $this->t('Flutter Inside in'), 'transition1102' => $this->t('Flutter Inside in Wind'), 'transition1103' => $this->t('Flutter Inside in Swirl'), 'transition1104' => $this->t('Flutter Inside in Column'), 'transition1105' => $this->t('Flutter Inside out'), 'transition1106' => $this->t('Flutter Inside out Wind'), 'transition1107' => $this->t('Flutter Inside out Swirl'), 'transition1108' => $this->t('Flutter Inside out Column')], 'Rotate Effects' => ['transition1201' => $this->t('Rotate VDouble+ in'), 'transition1202' => $this->t('Rotate HDouble+ in'), 'transition1203' => $this->t('Rotate VDouble- in'), 'transition1204' => $this->t('Rotate HDouble- in'), 'transition1205' => $this->t('Rotate VDouble+ out'), 'transition1206' => $this->t('Rotate HDouble+ out'), 'transition1207' => $this->t('Rotate VDouble- out'), 'transition1208' => $this->t('Rotate HDouble- out'), 'transition1209' => $this->t('Rotate VFork+ in'), 'transition1210' => $this->t('Rotate HFork+ in'), 'transition1211' => $this->t('Rotate VFork+ out'), 'transition1212' => $this->t('Rotate HFork+ out'), 'transition1213' => $this->t('Rotate Zoom+ in'), 'transition1214' => $this->t('Rotate Zoom+ in L'), 'transition1215' => $this->t('Rotate Zoom+ in R'), 'transition1216' => $this->t('Rotate Zoom+ in T'), 'transition1217' => $this->t('Rotate Zoom+ in B'), 'transition1218' => $this->t('Rotate Zoom+ in TL'), 'transition1219' => $this->t('Rotate Zoom+ in TR'), 'transition1220' => $this->t('Rotate Zoom+ in BL'), 'transition1221' => $this->t('Rotate Zoom+ in BR'), 'transition1222' => $this->t('Rotate Zoom+ out'), 'transition1223' => $this->t('Rotate Zoom+ out L'), 'transition1224' => $this->t('Rotate Zoom+ out R'), 'transition1225' => $this->t('Rotate Zoom+ out T'), 'transition1226' => $this->t('Rotate Zoom+ out B'), 'transition1227' => $this->t('Rotate Zoom+ out TL'), 'transition1228' => $this->t('Rotate Zoom+ out TR'), 'transition1229' => $this->t('Rotate Zoom+ out BL'), 'transition1230' => $this->t('Rotate Zoom+ out BR'), 'transition1231' => $this->t('Rotate Zoom+ in'), 'transition1232' => $this->t('Rotate Zoom+ in L'), 'transition1233' => $this->t('Rotate Zoom+ in R'), 'transition1234' => $this->t('Rotate Zoom+ in T'), 'transition1235' => $this->t('Rotate Zoom+ in B'), 'transition1236' => $this->t('Rotate Zoom+ in TL'), 'transition1237' => $this->t('Rotate Zoom+ in TR'), 'transition1238' => $this->t('Rotate Zoom+ in BL'), 'transition1239' => $this->t('Rotate Zoom+ in BR'), 'transition1240' => $this->t('Rotate Zoom- out'), 'transition1241' => $this->t('Rotate Zoom- out L'), 'transition1242' => $this->t('Rotate Zoom- out R'), 'transition1243' => $this->t('Rotate Zoom- out T'), 'transition1244' => $this->t('Rotate Zoom- out B'), 'transition1245' => $this->t('Rotate Zoom- out TL'), 'transition1246' => $this->t('Rotate Zoom- out TR'), 'transition1247' => $this->t('Rotate Zoom- out BL'), 'transition1248' => $this->t('Rotate Zoom- out BR')], 'Zoom Effects' => ['transition1301' => $this->t('Zoom VDouble+ in'), 'transition1302' => $this->t('Zoom HDouble+ in'), 'transition1303' => $this->t('Zoom VDouble- in'), 'transition1304' => $this->t('Zoom HDouble- in'), 'transition1305' => $this->t('Zoom VDouble+ out'), 'transition1306' => $this->t('Zoom HDouble+ out'), 'transition1307' => $this->t('Zoom VDouble- out'), 'transition1308' => $this->t('Zoom HDouble- out'), 'transition1309' => $this->t('Zoom+ in'), 'transition1310' => $this->t('Zoom+ in L'), 'transition1311' => $this->t('Zoom+ in R'), 'transition1312' => $this->t('Zoom+ in T'), 'transition1313' => $this->t('Zoom+ in B'), 'transition1314' => $this->t('Zoom+ in TL'), 'transition1315' => $this->t('Zoom+ in TR'), 'transition1316' => $this->t('Zoom+ in BL'), 'transition1317' => $this->t('Zoom+ in BR'), 'transition1318' => $this->t('Zoom+ out'), 'transition1319' => $this->t('Zoom+ out L'), 'transition1320' => $this->t('Zoom+ out R'), 'transition1321' => $this->t('Zoom+ out T'), 'transition1322' => $this->t('Zoom+ out B'), 'transition1323' => $this->t('Zoom+ out TL'), 'transition1324' => $this->t('Zoom+ out TR'), 'transition1325' => $this->t('Zoom+ out BL'), 'transition1326' => $this->t('Zoom+ out BR'), 'transition1327' => $this->t('Zoom- in'), 'transition1328' => $this->t('Zoom- in L'), 'transition1329' => $this->t('Zoom- in R'), 'transition1330' => $this->t('Zoom- in T'), 'transition1331' => $this->t('Zoom- in B'), 'transition1332' => $this->t('Zoom- in TL'), 'transition1333' => $this->t('Zoom- in TR'), 'transition1334' => $this->t('Zoom- in BL'), 'transition1335' => $this->t('Zoom- in BR'), 'transition1336' => $this->t('Zoom- out'), 'transition1337' => $this->t('Zoom- out L'), 'transition1338' => $this->t('Zoom- out R'), 'transition1339' => $this->t('Zoom- out T'), 'transition1340' => $this->t('Zoom- out B'), 'transition1341' => $this->t('Zoom- out TL'), 'transition1342' => $this->t('Zoom- out TR'), 'transition1343' => $this->t('Zoom- out BL'), 'transition1344' => $this->t('Zoom- out BR')], 'Collapse Effects' => ['transition1401' => $this->t('Collapse Stairs'), 'transition1402' => $this->t('Collapse Swirl'), 'transition1403' => $this->t('Collapse Square'), 'transition1404' => $this->t('Collapse Rectangle Cross'), 'transition1405' => $this->t('Collapse Rectangle'), 'transition1406' => $this->t('Collapse Cross'), 'transition1407' => $this->t('Collapse Circle'), 'transition1408' => $this->t('Collapse ZigZag'), 'transition1409' => $this->t('Collapse Random')], 'Compound Effects' => ['transition1501' => $this->t('Clip &amp; Chess in'), 'transition1502' => $this->t('Clip &amp; Chess out'), 'transition1503' => $this->t('Clip &amp; Oblique Chess in'), 'transition1504' => $this->t('Clip &amp; Oblique Chess out'), 'transition1505' => $this->t('Clip &amp; Wave in'), 'transition1506' => $this->t('Clip &amp; Wave out'), 'transition1507' => $this->t('Clip &amp; Jump in'), 'transition1508' => $this->t('Clip &amp; Jump out')], 'Expand Effects' => ['transition1601' => $this->t('Expand Stairs'), 'transition1602' => $this->t('Expand Straight'), 'transition1603' => $this->t('Expand Swirl'), 'transition1604' => $this->t('Expand Square'), 'transition1605' => $this->t('Expand Rectangle Cross'), 'transition1606' => $this->t('Expand Rectangle'), 'transition1607' => $this->t('Expand Cross'), 'transition1608' => $this->t('Expand ZigZag'), 'transition1609' => $this->t('Expand Random')], 'Stripe Effects' => ['transition1701' => $this->t('Dominoes Stripe'), 'transition1702' => $this->t('Extrude out Stripe'), 'transition1703' => $this->t('Extrude in Stripe'), 'transition1704' => $this->t('Horizontal Blind Stripe'), 'transition1705' => $this->t('Vertical Blind Stripe'), 'transition1706' => $this->t('Horizontal Stripe'), 'transition1707' => $this->t('Vertical Stripe'), 'transition1708' => $this->t('Horizontal Moving Stripe'), 'transition1709' => $this->t('Vertical Moving Stripe'), 'transition1710' => $this->t('Horizontal Fade Stripe'), 'transition1711' => $this->t('Vertical Fade Stripe'), 'transition1712' => $this->t('Horizontal Fly Stripe'), 'transition1713' => $this->t('Vertical Fly Stripe'), 'transition1714' => $this->t('Horizontal Chess Stripe'), 'transition1715' => $this->t('Vertical Chess Stripe'), 'transition1716' => $this->t('Horizontal Random Fade Stripe'), 'transition1717' => $this->t('Vertical Random Fade Stripe'), 'transition1718' => $this->t('Horizontal Bounce Stripe'), 'transition1719' => $this->t('Vertical Bounce Stripe')], 'Wave out Effects' => ['transition1801' => $this->t('Wave out'), 'transition1802' => $this->t('Wave out Eagle'), 'transition1803' => $this->t('Wave out Swirl'), 'transition1804' => $this->t('Wave out ZigZag'), 'transition1805' => $this->t('Wave out Square'), 'transition1806' => $this->t('Wave out Rectangle'), 'transition1807' => $this->t('Wave out Circle'), 'transition1808' => $this->t('Wave out Cross'), 'transition1809' => $this->t('Wave out Rectangle Cross')], 'Wave in Effects' => ['transition1901' => $this->t('Wave in'), 'transition1902' => $this->t('Wave in Eagle'), 'transition1903' => $this->t('Wave in Swirl'), 'transition1904' => $this->t('Wave in ZigZag'), 'transition1905' => $this->t('Wave in Square'), 'transition1906' => $this->t('Wave in Rectangle'), 'transition1907' => $this->t('Wave in Circle'), 'transition1908' => $this->t('Wave in Cross'), 'transition1909' => $this->t('Wave in Rectangle Cross')], 'Jump out Effects' => ['transition2001' => $this->t('Jump out Straight'), 'transition2002' => $this->t('Jump out Swirl'), 'transition2003' => $this->t('Jump out ZigZag'), 'transition2004' => $this->t('Jump out Square'), 'transition2005' => $this->t('Jump out Square with Chess'), 'transition2006' => $this->t('Jump out Rectangle'), 'transition2007' => $this->t('Jump out Circle'), 'transition2008' => $this->t('Jump out Rectangle Cross')], 'Jump in Effects' => ['transition2101' => $this->t('Jump in Straight'), 'transition2101' => $this->t('Jump in Straight'), 'transition2102' => $this->t('Jump in Swirl'), 'transition2103' => $this->t('Jump in ZigZag'), 'transition2104' => $this->t('Jump in Square'), 'transition2105' => $this->t('Jump in Square with Chess'), 'transition2106' => $this->t('Jump in Rectangle'), 'transition2107' => $this->t('Jump in Circle'), 'transition2108' => $this->t('Jump in Rectangle Cross')], 'Parabola Effects' => ['transition2201' => $this->t('Parabola Swirl in'), 'transition2202' => $this->t('Parabola Swirl out'), 'transition2203' => $this->t('Parabola ZigZag in'), 'transition2204' => $this->t('Parabola ZigZag out'), 'transition2205' => $this->t('Parabola Stairs in'), 'transition2206' => $this->t('Parabola Stairs out')], 'Float Effects' => ['transition2301' => $this->t('Float Right Random'), 'transition2302' => $this->t('Float up Random'), 'transition2303' => $this->t('Float up Random with Chess'), 'transition2304' => $this->t('Float Right ZigZag'), 'transition2305' => $this->t('Float up ZigZag'), 'transition2306' => $this->t('Float up ZigZag with Chess'), 'transition2307' => $this->t('Float Right Swirl'), 'transition2308' => $this->t('Float up Swirl'), 'transition2309' => $this->t('Float up Swirl with Chess')], 'Fly Effects' => ['transition2401' => $this->t('Fly Right Random'), 'transition2402' => $this->t('Fly up Random'), 'transition2403' => $this->t('Fly up Random with Chess'), 'transition2404' => $this->t('Fly Right ZigZag'), 'transition2405' => $this->t('Fly up ZigZag'), 'transition2406' => $this->t('Fly up ZigZag with Chess'), 'transition2407' => $this->t('Fly Right Swirl'), 'transition2408' => $this->t('Fly up Swirl'), 'transition2409' => $this->t('Fly up Swirl with Chess')], 'Stone Effects' => ['transition2501' => $this->t('Slide Down'), 'transition2502' => $this->t('Slide Right'), 'transition2503' => $this->t('Bounce Down'), 'transition2504' => $this->t('Bounce Right')]]];
     // Arrow navigator.
     $form['arrownavigator'] = array('#type' => 'fieldset', '#title' => $this->t('Arrow navigator'), '#states' => array('visible' => array(':input[name="style_options[global][arrownavigator]"]' => array('checked' => TRUE))));
     $arrowskin = [];
     for ($i = 1; $i < 22; $i++) {
         $i = $i < 10 ? '0' . $i : $i;
         $arrowskin[$i] = $this->t('Arrow ') . $i;
     }
     $form['arrownavigator']['arrowskin'] = array('#type' => 'select', '#title' => $this->t('Skin'), '#default_value' => isset($this->options['arrownavigator']['arrowskin']) ? $this->options['arrownavigator']['arrowskin'] : $this->options['arrowskin'], '#options' => $arrowskin);
     $form['arrownavigator']['autocenter'] = array('#type' => 'select', '#title' => $this->t('Auto center'), '#description' => $this->t('Auto center arrows in parent container.'), '#default_value' => isset($this->options['arrownavigator']['autocenter']) ? $this->options['arrownavigator']['autocenter'] : $this->options['autocenter'], '#options' => array(0 => $this->t('No'), 1 => $this->t('Horizontal'), 2 => $this->t('Vertical'), 3 => $this->t('Both')));
     $form['arrownavigator']['chancetoshow'] = array('#type' => 'select', '#title' => $this->t('Chance to show'), '#description' => $this->t('How to react on the bullet navigator.'), '#default_value' => isset($this->options['arrownavigator']['chancetoshow']) ? $this->options['arrownavigator']['chancetoshow'] : $this->options['chancetoshow'], '#options' => array(0 => $this->t('Never'), 1 => $this->t('Mouse Over'), 2 => $this->t('Always')));
     $form['arrownavigator']['steps'] = array('#type' => 'number', '#title' => $this->t('Steps'), '#description' => t('Steps to go for each navigation request.'), '#attributes' => array('min' => 1, 'step' => 1, 'value' => isset($this->options['arrownavigator']['steps']) ? $this->options['arrownavigator']['steps'] : $this->options['steps']));
     $form['arrownavigator']['scale'] = array('#type' => 'checkbox', '#title' => $this->t('Scales bullet navigator'), '#description' => t('Scales bullet navigator or not while slider scale.'), '#default_value' => isset($this->options['arrownavigator']['scale']) ? $this->options['arrownavigator']['scale'] : $this->options['scale']);
     // Bullet navigators.
     $form['bulletnavigator'] = array('#type' => 'fieldset', '#title' => $this->t('Bullet navigator'), '#states' => array('visible' => array(':input[name="style_options[global][bulletnavigator]"]' => array('checked' => TRUE))));
     $bulletskin = [];
     for ($i = 1; $i < 22; $i++) {
         $i = $i < 10 ? '0' . $i : $i;
         $bulletskin[$i] = $this->t('Bullet ') . $i;
     }
     $form['bulletnavigator']['bulletskin'] = array('#type' => 'select', '#title' => $this->t('Skin'), '#default_value' => isset($this->options['bulletnavigator']['bulletskin']) ? $this->options['bulletnavigator']['bulletskin'] : $this->options['bulletskin'], '#options' => $bulletskin);
     $form['bulletnavigator']['chancetoshow'] = array('#type' => 'select', '#title' => $this->t('Chance to show'), '#description' => $this->t('When to display the bullet navigator.'), '#default_value' => isset($this->options['bulletnavigator']['chancetoshow']) ? $this->options['bulletnavigator']['chancetoshow'] : $this->options['chancetoshow'], '#options' => array(0 => $this->t('Never'), 1 => $this->t('Mouse Over'), 2 => $this->t('Always')));
     $form['bulletnavigator']['action_mode'] = array('#type' => 'select', '#title' => $this->t('Action mode'), '#description' => $this->t('How to react on the bullet navigator.'), '#default_value' => isset($this->options['bulletnavigator']['action_mode']) ? $this->options['bulletnavigator']['action_mode'] : $this->options['action_mode'], '#options' => array(0 => $this->t('None'), 1 => $this->t('Act by click'), 2 => $this->t('Act by mouse hover'), 3 => $this->t('Act by click or mouse hover')));
     $form['bulletnavigator']['autocenter'] = array('#type' => 'select', '#title' => $this->t('Auto center'), '#description' => $this->t('Auto center arrows in parent container.'), '#default_value' => isset($this->options['bulletnavigator']['autocenter']) ? $this->options['bulletnavigator']['autocenter'] : $this->options['autocenter'], '#options' => array(0 => $this->t('No'), 1 => $this->t('Horizontal'), 2 => $this->t('Vertical'), 3 => $this->t('Both')));
     $form['bulletnavigator']['rows'] = array('#type' => 'number', '#title' => $this->t('Rows'), '#description' => t('Rows to arrange bullets.'), '#attributes' => array('min' => 1, 'step' => 1, 'value' => isset($this->options['bulletnavigator']['rows']) ? $this->options['bulletnavigator']['rows'] : $this->options['rows']));
     $form['bulletnavigator']['steps'] = array('#type' => 'number', '#title' => $this->t('Steps'), '#description' => t('Steps to go for each navigation request.'), '#attributes' => array('min' => 1, 'step' => 1, 'value' => isset($this->options['bulletnavigator']['steps']) ? $this->options['bulletnavigator']['steps'] : $this->options['steps']));
     $form['bulletnavigator']['spacingx'] = array('#type' => 'number', '#title' => $this->t('Horizontal space'), '#description' => t('Horizontal space between each item in pixel.'), '#attributes' => array('min' => 0, 'step' => 1, 'value' => isset($this->options['bulletnavigator']['spacingx']) ? $this->options['bulletnavigator']['spacingx'] : $this->options['spacingx']));
     $form['bulletnavigator']['spacingy'] = array('#type' => 'number', '#title' => $this->t('Vertical space'), '#description' => t('Vertical space between each item in pixel.'), '#attributes' => array('min' => 0, 'step' => 1, 'value' => isset($this->options['bulletnavigator']['spacingy']) ? $this->options['bulletnavigator']['spacingy'] : $this->options['spacingy']));
     $form['bulletnavigator']['orientation'] = array('#type' => 'select', '#title' => $this->t('Orientation'), '#description' => t('The orientation of the navigator.'), '#default_value' => isset($this->options['bulletnavigator']['orientation']) ? $this->options['bulletnavigator']['orientation'] : $this->options['orientation'], '#options' => array(1 => $this->t('Horizontal'), 2 => $this->t('Vertical')));
     $form['bulletnavigator']['scale'] = array('#type' => 'checkbox', '#title' => $this->t('Scales bullet navigator'), '#description' => t('Scales bullet navigator or not while slider scale.'), '#default_value' => isset($this->options['bulletnavigator']['scale']) ? $this->options['bulletnavigator']['scale'] : $this->options['scale']);
 }
コード例 #20
0
ファイル: Slideshow.php プロジェクト: pulibrary/recap
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     // Wrap all the form elements to help style the form.
     $form['views_slideshow_wrapper'] = array('#markup' => '<div id="views-slideshow-form-wrapper">');
     /**
      * Style.
      */
     $form['slideshow_skin_header'] = array('#markup' => '<h2>' . t('Style') . '</h2>');
     // Get a list of all available skins.
     $skin_info = $this->getSkins();
     foreach ($skin_info as $skin => $info) {
         $skins[$skin] = $info['name'];
     }
     asort($skins);
     // Create the drop down box so users can choose an available skin.
     $form['slideshow_skin'] = array('#type' => 'select', '#title' => t('Skin'), '#options' => $skins, '#default_value' => $this->options['slideshow_skin'], '#description' => t('Select the skin to use for this display.  Skins allow for easily swappable layouts of things like next/prev links and thumbnails.  Note that not all skins support all widgets, so a combination of skins and widgets may lead to unpredictable results in layout.'));
     /**
      * Slides
      */
     $form['slides_header'] = array('#markup' => '<h2>' . t('Slides') . '</h2>');
     // Get all slideshow types.
     $slideshows = \Drupal::moduleHandler()->invokeAll('views_slideshow_slideshow_info');
     if ($slideshows) {
         // Build our slideshow options for the form.
         $slideshow_options = array();
         foreach ($slideshows as $slideshow_id => $slideshow_info) {
             $slideshow_options[$slideshow_id] = $slideshow_info['name'];
         }
         $form['slideshow_type'] = array('#type' => 'select', '#title' => t('Slideshow Type'), '#options' => $slideshow_options, '#default_value' => $this->options['slideshow_type']);
         $arguments = array(&$form, &$form_state, &$this);
         foreach (\Drupal::moduleHandler()->getImplementations('views_slideshow_slideshow_type_form') as $module) {
             $form[$module] = array('#type' => 'fieldset', '#title' => t('!module options', array('!module' => $slideshows[$module]['name'])), '#collapsible' => TRUE, '#attributes' => array('class' => array($module)), '#states' => array('visible' => array(':input[name="style_options[slideshow_type]"]' => array('value' => $module))));
             $function = $module . '_views_slideshow_slideshow_type_form';
             call_user_func_array($function, $arguments);
         }
     } else {
         $form['enable_module'] = array('#markup' => t('There is no Views Slideshow plugin enabled. Go to the !modules and enable a Views Slideshow plugin module. For example Views Slideshow Singleframe.', array('!modules' => \Drupal::l(t('Modules Page'), Url::fromRoute('system.modules_list')))));
     }
     /**
      * Widgets
      */
     $form['widgets_header'] = array('#markup' => '<h2>' . t('Widgets') . '</h2>');
     // Loop through all locations so we can add header for each location.
     $location = array('top' => t('Top'), 'bottom' => t('Bottom'));
     foreach ($location as $location_id => $location_name) {
         // Widget Header
         $form['widgets'][$location_id]['header'] = array('#markup' => '<h3>' . t('!location Widgets', array('!location' => $location_name)) . '</h3>');
     }
     // Get all widgets that are registered.
     // If we have widgets then build it's form fields.
     $widgets = \Drupal::moduleHandler()->invokeAll('views_slideshow_widget_info');
     if (!empty($widgets)) {
         // Build our weight values by number of widgets
         $weights = array();
         for ($i = 1; $i <= count($widgets); $i++) {
             $weights[$i] = $i;
         }
         // Loop through our widgets and locations to build our form values for
         // each widget.
         foreach ($widgets as $widget_id => $widget_info) {
             foreach ($location as $location_id => $location_name) {
                 $widget_dependency = 'style_options[widgets][' . $location_id . '][' . $widget_id . ']';
                 // Determine if a widget is compatible with a slideshow.
                 $compatible_slideshows = array();
                 foreach ($slideshows as $slideshow_id => $slideshow_info) {
                     $is_compatible = 1;
                     // Check if every required accept value in the widget has a
                     // corresponding calls value in the slideshow.
                     foreach ($widget_info['accepts'] as $accept_key => $accept_value) {
                         if (is_array($accept_value) && !empty($accept_value['required']) && !in_array($accept_key, $slideshow_info['calls'])) {
                             $is_compatible = 0;
                             break;
                         }
                     }
                     // No need to go through this if it's not compatible.
                     if ($is_compatible) {
                         // Check if every required calls value in the widget has a
                         // corresponding accepts call.
                         foreach ($widget_info['calls'] as $calls_key => $calls_value) {
                             if (is_array($calls_value) && !empty($calls_value['required']) && !in_array($calls_key, $slideshow_info['accepts'])) {
                                 $is_compatible = 0;
                                 break;
                             }
                         }
                     }
                     // If it passed all those tests then they are compatible.
                     if ($is_compatible) {
                         $compatible_slideshows[] = $slideshow_id;
                     }
                 }
                 // Use Widget Checkbox
                 $form['widgets'][$location_id][$widget_id]['enable'] = array('#type' => 'checkbox', '#title' => t($widget_info['name']), '#default_value' => $this->options['widgets'][$location_id][$widget_id]['enable'], '#description' => t('Should !name be rendered at the !location of the slides.', array('!name' => $widget_info['name'], '!location' => $location_name)));
                 $form['widgets'][$location_id][$widget_id]['enable']['#dependency']['edit-style-options-slideshow-type'] = !empty($compatible_slideshows) ? $compatible_slideshows : array('none');
                 // Need to wrap this so it indents correctly.
                 $form['widgets'][$location_id][$widget_id]['wrapper'] = array('#markup' => '<div class="vs-dependent">');
                 // Widget weight
                 // We check to see if the default value is greater than the number of
                 // widgets just in case a widget has been removed and the form hasn't
                 // been saved again.
                 $weight = isset($this->options['widgets'][$location_id][$widget_id]['weight']) ? $this->options['widgets'][$location_id][$widget_id]['weight'] : 0;
                 if ($weight > count($widgets)) {
                     $weight = count($widgets);
                 }
                 $form['widgets'][$location_id][$widget_id]['weight'] = array('#type' => 'select', '#title' => t('Weight of the !name', array('!name' => $widget_info['name'])), '#default_value' => $weight, '#options' => $weights, '#description' => t('Determines in what order the !name appears.  A lower weight will cause the !name to be above higher weight items.', array('!name' => $widget_info['name'])), '#prefix' => '<div class="vs-dependent">', '#suffix' => '</div>', '#states' => array('visible' => array(':input[name="style_options[widgets][' . $location_id . '][' . $widget_id . '][enable]"]' => array('checked' => TRUE))));
                 // Add all the widget settings.
                 if (function_exists($widget_id . '_views_slideshow_widget_form_options')) {
                     $arguments = array(&$form['widgets'][$location_id][$widget_id], &$form_state, &$this, $this->options['widgets'][$location_id][$widget_id], $widget_dependency);
                     call_user_func_array($widget_id . '_views_slideshow_widget_form_options', $arguments);
                 }
                 $form['widgets'][$location_id][$widget_id]['wrapper_close'] = array('#markup' => '</div>');
             }
         }
     }
     $form['views_slideshow_wrapper_close'] = array('#markup' => '</div>');
     $form['#attached']['library'] = array('views_slideshow/form');
 }
コード例 #21
0
ファイル: CommonMap.php プロジェクト: pedrocones/geolocation
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $labels = $this->displayHandler->getFieldLabels();
     $fieldMap = \Drupal::entityManager()->getFieldMap();
     $geo_options = [];
     $title_options = [];
     $fields = $this->displayHandler->getOption('fields');
     foreach ($fields as $field_name => $field) {
         if ($field['plugin_id'] == 'geolocation_field') {
             $geo_options[$field_name] = $labels[$field_name];
         }
         if ($field['plugin_id'] == 'field' && !empty($field['entity_type']) && !empty($field['entity_field'])) {
             if (!empty($fieldMap[$field['entity_type']][$field['entity_field']]['type']) && $fieldMap[$field['entity_type']][$field['entity_field']]['type'] == 'geolocation') {
                 $geo_options[$field_name] = $labels[$field_name];
             }
         }
         if ($field['type'] == 'string') {
             $title_options[$field_name] = $labels[$field_name];
         }
     }
     $form['geolocation_field'] = ['#title' => $this->t('Geolocation source field'), '#type' => 'select', '#default_value' => $this->options['geolocation_field'], '#description' => $this->t("The source of geodata for each entity."), '#options' => $geo_options];
     $form['title_field'] = ['#title' => $this->t('Title source field'), '#type' => 'select', '#default_value' => $this->options['title_field'], '#description' => $this->t("The source of the title for each entity. Must be string"), '#options' => $title_options];
     $form['centre'] = ['#title' => $this->t('Source for centre coordinates'), '#type' => 'radios', '#default_value' => $this->options['centre'], '#description' => $this->t("How to determine the centre of the map."), '#options' => ['first_row' => $this->t('Use first row as centre.'), 'none' => $this->t('Solely rely on Google fitBounds function to include all locations.'), 'fixed_value' => $this->t('Provide fixed latitude and longitude.')]];
     $form['centre_fixed_values'] = ['#title' => $this->t('Fixed values for centre'), '#type' => 'container', 'latitude' => ['#type' => 'textfield', '#title' => t('Latitude'), '#default_value' => $this->options['centre_fixed_values']['latitude'], '#size' => 60, '#maxlength' => 128], 'longitude' => ['#type' => 'textfield', '#title' => t('Longitude'), '#default_value' => $this->options['centre_fixed_values']['longitude'], '#size' => 60, '#maxlength' => 128], '#description' => $this->t("The source of geodata for each entity. Must be string"), '#states' => ['visible' => [':input[name="style_options[centre]"]' => ['value' => 'fixed_value']]]];
 }
コード例 #22
0
ファイル: Slideshow.php プロジェクト: dmyerson/d8ecs
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     // Wrap all the form elements to help style the form.
     $form['views_slideshow_wrapper'] = array('#markup' => '<div id="views-slideshow-form-wrapper">');
     // Skins.
     $form['slideshow_skin_header'] = array('#markup' => '<h2>' . t('Style') . '</h2>');
     /** @var \Drupal\Component\Plugin\PluginManagerInterface */
     $skinManager = \Drupal::service('plugin.manager.views_slideshow.slideshow_skin');
     // Get all skins to create the option list.
     $skins = [];
     foreach ($skinManager->getDefinitions() as $id => $definition) {
         $skins[$id] = $definition['label'];
     }
     asort($skins);
     // Create the drop down box so users can choose an available skin.
     $form['slideshow_skin'] = array('#type' => 'select', '#title' => t('Skin'), '#options' => $skins, '#default_value' => $this->options['slideshow_skin'], '#description' => t('Select the skin to use for this display.  Skins allow for easily swappable layouts of things like next/prev links and thumbnails.  Note that not all skins support all widgets, so a combination of skins and widgets may lead to unpredictable results in layout.'));
     // Slides.
     $form['slides_header'] = array('#markup' => '<h2>' . t('Slides') . '</h2>');
     // Get all slideshow types.
     $typeManager = \Drupal::service('plugin.manager.views_slideshow.slideshow_type');
     $types = $typeManager->getDefinitions();
     if ($types) {
         // Build our slideshow options for the form.
         $slideshow_options = array();
         foreach ($types as $id => $definition) {
             $slideshow_options[$id] = $definition['label'];
         }
         $form['slideshow_type'] = array('#type' => 'select', '#title' => t('Slideshow Type'), '#options' => $slideshow_options, '#default_value' => $this->options['slideshow_type']);
         // @todo: check if default values are properly passed to the buildConfigurationForm().
         foreach ($types as $id => $definition) {
             $configuration = [];
             if (!empty($this->options[$id])) {
                 $configuration = $this->options[$id];
             }
             $instance = $typeManager->createInstance($id, $configuration);
             $form[$id] = array('#type' => 'fieldset', '#title' => t('@module options', array('@module' => $definition['label'])), '#collapsible' => TRUE, '#attributes' => array('class' => array($id)), '#states' => array('visible' => array(':input[name="style_options[slideshow_type]"]' => array('value' => $id))));
             $form = $instance->buildConfigurationForm($form, $form_state);
         }
     } else {
         $form['enable_module'] = array('#markup' => t('There is no Views Slideshow plugin enabled. Go to the @modules and enable a Views Slideshow plugin module. For example Views Slideshow Singleframe.', array('@modules' => \Drupal::l(t('Modules Page'), Url::fromRoute('system.modules_list')))));
     }
     // Widgets.
     // @todo: Improve the UX by using Ajax.
     $form['widgets_header'] = array('#markup' => '<h2>' . t('Widgets') . '</h2>');
     // Define the available locations.
     $location = array('top' => t('Top'), 'bottom' => t('Bottom'));
     // Loop through all locations so we can add header for each location.
     foreach ($location as $location_id => $location_name) {
         $form['widgets'][$location_id]['header'] = array('#markup' => '<h3>' . t('@location Widgets', array('@location' => $location_name)) . '</h3>');
     }
     /** @var \Drupal\Component\Plugin\PluginManagerInterface */
     $widgetTypeManager = \Drupal::service('plugin.manager.views_slideshow.widget_type');
     // Get all widgets types that are registered.
     $widgets = $widgetTypeManager->getDefinitions();
     if (!empty($widgets)) {
         // Build our weight values by number of widgets
         $weights = [];
         for ($i = 1; $i <= count($widgets); $i++) {
             $weights[$i] = $i;
         }
         // Loop through our widgets and locations to build our form values for
         // each widget.
         foreach ($widgets as $widget_id => $widget_info) {
             // Determine if this widget type is compatible with any slideshow type.
             $compatible_slideshows = [];
             foreach ($types as $slideshow_id => $slideshow_info) {
                 if ($widgetTypeManager->createInstance($widget_id, [])->checkCompatiblity($slideshow_info)) {
                     $compatible_slideshows[] = $slideshow_id;
                 }
             }
             // Display the widget config form only if the widget type is compatible
             // with at least one slideshow type.
             if (!empty($compatible_slideshows)) {
                 foreach ($location as $location_id => $location_name) {
                     // Use Widget Checkbox.
                     $form['widgets'][$location_id][$widget_id]['enable'] = array('#type' => 'checkbox', '#title' => $widget_info['label'], '#default_value' => $this->options['widgets'][$location_id][$widget_id]['enable'], '#description' => t('Should @name be rendered at the @location of the slides.', array('@name' => $widget_info['label'], '@location' => $location_name)), '#dependency' => array('edit-style-options-slideshow-type' => $compatible_slideshows));
                     // Need to wrap this so it indents correctly.
                     $form['widgets'][$location_id][$widget_id]['wrapper'] = ['#markup' => '<div class="vs-dependent">'];
                     // Widget weight.
                     // We check to see if the default value is greater than the number
                     // of widgets just in case a widget has been removed and the form
                     // hasn't been saved again.
                     $weight = isset($this->options['widgets'][$location_id][$widget_id]['weight']) ? $this->options['widgets'][$location_id][$widget_id]['weight'] : 0;
                     if ($weight > count($widgets)) {
                         $weight = count($widgets);
                     }
                     $form['widgets'][$location_id][$widget_id]['weight'] = ['#type' => 'select', '#title' => t('Weight of the @name', ['@name' => $widget_info['label']]), '#default_value' => $weight, '#options' => $weights, '#description' => t('Determines in what order the @name appears. A lower weight will cause the @name to be above higher weight items.', ['@name' => $widget_info['label']]), '#prefix' => '<div class="vs-dependent">', '#suffix' => '</div>', '#states' => ['visible' => [':input[name="style_options[widgets][' . $location_id . '][' . $widget_id . '][enable]"]' => ['checked' => TRUE]]]];
                     // Build the appropriate array for the states API.
                     $widget_dependency = 'style_options[widgets][' . $location_id . '][' . $widget_id . ']';
                     // Get the current configuration of this widget type.
                     $configuration = [];
                     if (!empty($this->options['widgets'][$location_id][$widget_id])) {
                         $configuration = $this->options['widgets'][$location_id][$widget_id];
                     }
                     $configuration['dependency'] = $widget_dependency;
                     $instance = $widgetTypeManager->createInstance($widget_id, $configuration);
                     // Get the configuration form of this widget type.
                     $form['widgets'][$location_id][$widget_id] = $instance->buildConfigurationForm($form['widgets'][$location_id][$widget_id], $form_state);
                     // Close the vs-dependent wrapper.
                     $form['widgets'][$location_id][$widget_id]['wrapper_close'] = ['#markup' => '</div>'];
                 }
             }
         }
     }
     // Browse locations and remove the header if no widget is available.
     foreach ($location as $location_id => $location_name) {
         // If no widget is available, the only key is "header".
         if (count(array_keys($form['widgets'][$location_id])) == 1) {
             unset($form['widgets'][$location_id]);
         }
     }
     // Remove the widget section header if there is no widget available.
     if (empty($form['widgets'])) {
         unset($form['widgets']);
         unset($form['widgets_header']);
     }
     $form['views_slideshow_wrapper_close'] = ['#markup' => '</div>'];
     // Add a library to style the form.
     $form['#attached']['library'] = ['views_slideshow/form'];
 }
コード例 #23
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $fields = array();
     $fields_info = array();
     // Get list of fields in this view & flag available geodata fields.
     $handlers = $this->displayHandler->getHandlers('field');
     $field_definition = $this->displayHandler->getOption('fields');
     // Check for any fields, as the view needs them.
     if (empty($handlers)) {
         $form['error_markup'] = array('#value' => t('You need to enable at least one field before you can configure your field settings'), '#prefix' => '<div class="error form-item description">', '#suffix' => '</div>');
         return;
     }
     // Go through fields, fill $fields and $fields_info arrays.
     foreach ($this->displayHandler->getHandlers('field') as $field_id => $handler) {
         $fields[$field_id] = $handler->definition['title'];
         $fields_info[$field_id]['type'] = $field_definition[$field_id]['type'];
     }
     // Default data source.
     $data_source_options = array('latlon' => t('Other: Lat/Lon Point'), 'geofield' => t('Geofield'), 'wkt' => t('WKT'));
     // Data Source options.
     $form['data_source'] = array('#type' => 'fieldset', '#tree' => TRUE, '#title' => t('Data Source'));
     $form['data_source']['value'] = array('#type' => 'select', '#multiple' => FALSE, '#title' => t('Map Data Sources'), '#description' => t('Choose which sources of data that the map will provide features for.'), '#options' => $data_source_options, '#default_value' => $this->options['data_source']['value']);
     // Other Lat and Lon data sources.
     if (count($fields) > 0) {
         $form['data_source']['latitude'] = array('#type' => 'select', '#title' => t('Latitude Field'), '#description' => t('Choose a field for Latitude.  This should be a field that is a decimal or float value.'), '#options' => $fields, '#default_value' => $this->options['data_source']['latitude'], '#states' => array('visible' => array(':input[name="style_options[data_source][value]"]' => array('value' => 'latlon'))));
         $form['data_source']['longitude'] = array('#type' => 'select', '#title' => t('Longitude Field'), '#description' => t('Choose a field for Longitude.  This should be a field that is a decimal or float value.'), '#options' => $fields, '#default_value' => $this->options['data_source']['longitude'], '#states' => array('visible' => array(':input[name="style_options[data_source][value]"]' => array('value' => 'latlon'))));
         // Get Geofield-type fields.
         $geofield_fields = array();
         foreach ($fields as $field_id => $field) {
             // @TODO We need to check if the field type is `geofield_default`. But
             // at the moment this information is missing from the array, due to a
             // bug with Geofield 8.x-1.x-dev. When the bug is fixed, we can add a
             // check here again.
             $geofield_fields[$field_id] = $field;
         }
         // Geofield.
         $form['data_source']['geofield'] = array('#type' => 'select', '#title' => t('Geofield'), '#description' => t("Choose a Geofield field. Any formatter will do; we'll access Geofield's underlying WKT format."), '#options' => $geofield_fields, '#default_value' => $this->options['data_source']['geofield'], '#states' => array('visible' => array(':input[name="style_options[data_source][value]"]' => array('value' => 'geofield'))));
         // WKT.
         $form['data_source']['wkt'] = array('#type' => 'select', '#title' => t('WKT'), '#description' => t('Choose a WKT format field.'), '#options' => $fields, '#default_value' => $this->options['data_source']['wkt'], '#states' => array('visible' => array(':input[name="style_options[data_source][value]"]' => array('value' => 'wkt'))));
     }
     $form['data_source']['name_field'] = array('#type' => 'select', '#title' => t('Title Field'), '#description' => t('Choose the field to appear as title on tooltips.'), '#options' => array_merge(array('' => ''), $fields), '#default_value' => $this->options['data_source']['name_field']);
     $form['data_source']['description_field'] = array('#type' => 'select', '#title' => t('Description'), '#description' => t('Choose the field or rendering method to appear as
       description on tooltips.'), '#required' => FALSE, '#options' => array_merge(array('' => ''), $fields), '#default_value' => $this->options['data_source']['description_field']);
     // Attributes and variable styling description.
     $form['attributes'] = array('#type' => 'fieldset', '#title' => t('Attributes and Styling'), '#description' => t('Attributes are field data attached to each feature.  This can be used with styling to create Variable styling.'), '#collapsible' => TRUE, '#collapsed' => TRUE);
     $form['jsonp_prefix'] = array('#type' => 'textfield', '#title' => t('JSONP prefix'), '#default_value' => $this->options['jsonp_prefix'], '#description' => t('If used the JSON output will be enclosed with parentheses and prefixed by this label, as in the JSONP format.'));
     // Make array of attributes.
     $variable_fields = array();
     // Add name and description.
     if (!empty($this->options['data_source']['name_field'])) {
         $variable_fields['name'] = '${name}';
     }
     if (!empty($this->options['data_source']['description_field'])) {
         $variable_fields['description'] = '${description}';
     }
     // Go through fields again to ID variable fields.
     // TODO: is it necessary to call getHandlers twice or can we reuse data from $fields?
     foreach ($this->displayHandler->getHandlers('field') as $field => $handler) {
         if ($field != $this->options['data_source']['name_field'] && $field != $this->options['data_source']['description_field']) {
             $variable_fields[$field] = '${' . $field . '}';
         }
     }
     // TODO: Figure out what will work here. This syntax is probably wrong!
     $variables_list = array('#theme' => 'item_list', '#items' => $variable_fields, '#attributes' => array('class' => array('description')));
     $markup = '<p class="description">' . t('Fields added to this view will be attached to their respective feature, (point, line, polygon,) as attributes.
   These attributes can then be used to add variable styling to your themes. This is accomplished by using the %syntax
   syntax in the values for a style.  The following is a list of formatted variables that are currently available;
   these can be placed right in the style interface.', array('%syntax' => '${field_name}')) . '</p>';
     // TODO: Replace this with the dedicated renderer access call (if one exists). See: https://api.drupal.org/api/drupal/core%21lib%21Drupal.php/function/Drupal%3A%3Aservice/8
     $markup .= \Drupal::service('renderer')->render($variables_list);
     $markup .= '<p class="description">' . t('Please note that this does not apply to Grouped Displays.') . '</p>';
     $form['attributes']['styling'] = array('#type' => 'markup', '#markup' => $markup);
 }
コード例 #24
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.'), '#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);
 }
コード例 #25
0
ファイル: Calendar.php プロジェクト: CIGIHub/bsia-drupal8
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['calendar_type'] = ['#title' => $this->t('Calendar type'), '#type' => 'select', '#description' => $this->t('Select the calendar time period for this display.'), '#default_value' => $this->options['calendar_type'], '#options' => CalendarHelper::displayTypes()];
     $form['mini'] = ['#title' => $this->t('Display as mini calendar'), '#default_value' => $this->options['mini'], '#type' => 'radios', '#options' => [0 => $this->t('No'), 1 => $this->t('Yes')], '#description' => $this->t('Display the mini style calendar, with no item details. Suitable for a calendar displayed in a block.'), '#dependency' => ['edit-style-options-calendar-type' => ['month']], '#states' => ['visible' => [':input[name="style_options[calendar_type]"]' => ['value' => 'month']]]];
     $form['name_size'] = ['#title' => $this->t('Calendar day of week names'), '#default_value' => $this->options['name_size'], '#type' => 'radios', '#options' => [1 => $this->t('First letter of name'), 2 => $this->t('First two letters of name'), 3 => $this->t('Abbreviated name'), 99 => $this->t('Full name')], '#description' => $this->t('The way day of week names should be displayed in a calendar.'), '#states' => ['visible' => [':input[name="style_options[calendar_type]"]' => [['value' => 'year'], ['value' => 'month'], ['value' => 'week']]]]];
     $form['with_weekno'] = ['#title' => $this->t('Show week numbers'), '#default_value' => $this->options['with_weekno'], '#type' => 'radios', '#options' => [0 => $this->t('No'), 1 => $this->t('Yes')], '#description' => $this->t('Whether or not to show week numbers in the left column of calendar weeks and months.'), '#states' => ['visible' => [':input[name="style_options[calendar_type]"]' => ['value' => 'month']]]];
     $form['max_items'] = ['#title' => $this->t('Maximum items'), '#type' => 'select', '#options' => [0 => $this->t('Unlimited'), 1 => $this->formatPlural(1, '1 item', '@count items'), 3 => $this->formatPlural(3, '1 item', '@count items'), 5 => $this->formatPlural(5, '1 item', '@count items'), 10 => $this->formatPlural(10, '1 item', '@count items')], '#default_value' => $this->options['calendar_type'] != 'day' ? $this->options['max_items'] : 0, '#description' => $this->t('Maximum number of items to show in calendar cells, used to keep the calendar from expanding to a huge size when there are lots of items in one day.'), '#states' => ['visible' => [':input[name="style_options[calendar_type]"]' => ['value' => 'month']]]];
     $form['max_items_behavior'] = ['#title' => $this->t('Too many items'), '#type' => 'select', '#options' => ['more' => $this->t("Show maximum, add 'more' link"), 'hide' => $this->t('Hide all, add link to day')], '#default_value' => $this->options['calendar_type'] != 'day' ? $this->options['max_items_behavior'] : 'more', '#description' => $this->t('Behavior when there are more than the above number of items in a single day. When there more items than this limit, a link to the day view will be displayed.'), '#states' => ['visible' => [':input[name="style_options[calendar_type]"]' => ['value' => 'month']]]];
     $form['groupby_times'] = ['#title' => $this->t('Time grouping'), '#type' => 'select', '#default_value' => $this->options['groupby_times'], '#description' => $this->t("Group items together into time periods based on their start time."), '#options' => ['' => $this->t('None'), 'hour' => $this->t('Hour'), 'half' => $this->t('Half hour'), 'custom' => $this->t('Custom')], '#states' => ['visible' => [':input[name="style_options[calendar_type]"]' => [['value' => 'day'], ['value' => 'week']]]]];
     $form['groupby_times_custom'] = ['#title' => $this->t('Custom time grouping'), '#type' => 'textarea', '#default_value' => $this->options['groupby_times_custom'], '#description' => $this->t("When choosing the 'custom' Time grouping option above, create custom time period groupings as a comma-separated list of 24-hour times in the format HH:MM:SS, like '00:00:00,08:00:00,18:00:00'. Be sure to start with '00:00:00'. All items after the last time will go in the final group."), '#states' => ['visible' => [':input[name="style_options[groupby_times]"]' => ['value' => 'custom']]]];
     $form['theme_style'] = ['#title' => $this->t('Overlapping time style'), '#default_value' => $this->options['theme_style'], '#type' => 'select', '#options' => [0 => $this->t('Do not display overlapping items'), 1 => $this->t('Display overlapping items, with scrolling'), 2 => $this->t('Display overlapping items, no scrolling')], '#description' => $this->t('Select whether calendar items are displayed as overlapping items. Use scrolling to shrink the window and focus on the selected items, or omit scrolling to display the whole day. This only works if hour or half hour time grouping is chosen!'), '#states' => ['visible' => [':input[name="style_options[calendar_type]"]' => [['value' => 'day'], ['value' => 'week']]]]];
     // Create a list of fields that are available for grouping.
     $field_options = [];
     $fields = $this->view->display_handler->getOption('fields');
     foreach ($fields as $field_name => $field) {
         $field_options[$field_name] = $field['field'];
     }
     $form['groupby_field'] = ['#title' => $this->t('Field grouping'), '#type' => 'select', '#default_value' => $this->options['groupby_field'], '#description' => $this->t("Optionally group items into columns by a field value, for instance select the content type to show items for each content type in their own column, or use a location field to organize items into columns by location. NOTE! This is incompatible with the overlapping style option."), '#options' => ['' => ''] + $field_options, '#states' => ['visible' => [':input[name="style_options[calendar_type]"]' => ['value' => 'day']]]];
     $form['multiday_theme'] = ['#title' => $this->t('Multi-day style'), '#default_value' => $this->options['multiday_theme'], '#type' => 'select', '#options' => [0 => $this->t('Display multi-day item as a single column'), 1 => $this->t('Display multi-day item as a multiple column row')], '#description' => $this->t('If selected, items which span multiple days will displayed as a multi-column row.  If not selected, items will be displayed as an individual column.'), '#states' => ['visible' => [':input[name="style_options[calendar_type]"]' => [['value' => 'month'], ['value' => 'week']]]]];
     $form['multiday_hidden'] = ['#title' => $this->t('Fields to hide in Multi-day rows'), '#default_value' => $this->options['multiday_hidden'], '#type' => 'checkboxes', '#options' => $field_options, '#description' => $this->t('Choose fields to hide when displayed in multi-day rows. Usually you only want to see the title or Colorbox selector in multi-day rows and would hide all other fields.'), '#states' => ['visible' => [':input[name="style_options[calendar_type]"]' => [['value' => 'month'], ['value' => 'week'], ['value' => 'day']]]]];
     // Allow custom Day and Week links
     $form['granularity_links'] = ['#tree' => TRUE];
     $form['granularity_links']['day'] = ['#title' => $this->t('Day link displays'), '#type' => 'select', '#default_value' => $this->options['granularity_links']['day'], '#description' => $this->t("Optionally select a View display to use for Day links."), '#options' => ['' => $this->t('Default display')] + $this->viewOptionsForGranularity('day')];
     $form['granularity_links']['week'] = ['#title' => $this->t('Week link displays'), '#type' => 'select', '#default_value' => $this->options['granularity_links']['week'], '#description' => $this->t("Optionally select a View display to use for Week links."), '#options' => ['' => $this->t('Default display')] + $this->viewOptionsForGranularity('week')];
 }
コード例 #26
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $labels = $this->displayHandler->getFieldLabels();
     $fieldMap = \Drupal::entityManager()->getFieldMap();
     $geo_options = [];
     $title_options = [];
     $filters = $this->displayHandler->getOption('filters');
     $fields = $this->displayHandler->getOption('fields');
     foreach ($fields as $field_name => $field) {
         if ($field['plugin_id'] == 'geolocation_field') {
             $geo_options[$field_name] = $labels[$field_name];
         }
         if ($field['plugin_id'] == 'field' && !empty($field['entity_type']) && !empty($field['entity_field'])) {
             if (!empty($fieldMap[$field['entity_type']][$field['entity_field']]['type']) && $fieldMap[$field['entity_type']][$field['entity_field']]['type'] == 'geolocation') {
                 $geo_options[$field_name] = $labels[$field_name];
             }
         }
         if ($field['type'] == 'string') {
             $title_options[$field_name] = $labels[$field_name];
         }
     }
     $form['geolocation_field'] = ['#title' => $this->t('Geolocation source field'), '#type' => 'select', '#default_value' => $this->options['geolocation_field'], '#description' => $this->t("The source of geodata for each entity."), '#options' => $geo_options];
     $form['title_field'] = ['#title' => $this->t('Title source field'), '#type' => 'select', '#default_value' => $this->options['title_field'], '#description' => $this->t("The source of the title for each entity. Must be string"), '#options' => $title_options];
     $options = ['first_row' => $this->t('Use first row as centre.'), 'fixed_value' => $this->t('Provide fixed latitude and longitude.')];
     foreach ($filters as $filter_name => $filter) {
         if (empty($filter['plugin_id']) || $filter['plugin_id'] != 'geolocation_filter_proximity') {
             continue;
         }
         $options['proximity_filter_' . $filter_name] = $this->displayHandler->getHandler('filter', $filter_name)->adminLabel();
     }
     $form['centre'] = ['#type' => 'table', '#header' => [t('Enable'), t('Option'), t('settings'), array('data' => t('Settings'), 'colspan' => '1')], '#attributes' => ['id' => 'geolocation-centre-options'], '#tabledrag' => [['action' => 'order', 'relationship' => 'sibling', 'group' => 'geolocation-centre-option-weight']]];
     foreach ($options as $id => $label) {
         $weight = $this->options['centre'][$id]['weight'] ?: 0;
         $form['centre'][$id]['#weight'] = $weight;
         $form['centre'][$id]['enable'] = ['#type' => 'checkbox', '#default_value' => isset($this->options['centre'][$id]['enable']) ? $this->options['centre'][$id]['enable'] : TRUE];
         $form['centre'][$id]['option'] = ['#markup' => $label];
         // Optionally, to add tableDrag support:
         $form['centre'][$id]['#attributes']['class'][] = 'draggable';
         $form['centre'][$id]['weight'] = ['#type' => 'weight', '#title' => t('Weight for @option', ['@option' => $label]), '#title_display' => 'invisible', '#size' => 4, '#default_value' => $weight, '#attributes' => ['class' => ['geolocation-centre-option-weight']]];
     }
     $form['centre']['fixed_value']['settings'] = ['#title' => $this->t('Fixed values for centre'), '#type' => 'container', 'latitude' => ['#type' => 'textfield', '#title' => t('Latitude'), '#default_value' => $this->options['centre']['fixed_value']['settings']['latitude'], '#size' => 60, '#maxlength' => 128], 'longitude' => ['#type' => 'textfield', '#title' => t('Longitude'), '#default_value' => $this->options['centre']['fixed_value']['settings']['longitude'], '#size' => 60, '#maxlength' => 128], '#description' => $this->t("The source of geodata for each entity. Must be string"), '#states' => ['visible' => [':input[name="style_options[centre][fixed_value][enable]"]' => ['checked' => TRUE]]]];
     uasort($form['centre'], 'Drupal\\Component\\Utility\\SortArray::sortByWeightProperty');
 }
コード例 #27
0
ファイル: Rss.php プロジェクト: Nikola-xiii/d8intranet
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['description'] = array('#type' => 'textfield', '#title' => $this->t('RSS description'), '#default_value' => $this->options['description'], '#description' => $this->t('This will appear in the RSS feed itself.'), '#maxlength' => 1024);
 }
コード例 #28
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $options = $this->displayHandler->getFieldLabels(TRUE);
     $form['tab_nav_field'] = array('#title' => $this->t('The tab navigation field'), '#description' => $this->t('Select the field that will be used as the tab navigation. The rest of the fields will show up in the tab content.'), '#type' => 'select', '#default_value' => $this->options['tab_nav_field'], '#options' => $options);
 }