当前位置: 首页>>代码示例>>PHP>>正文


PHP FieldPluginBase::buildOptionsForm方法代码示例

本文整理汇总了PHP中Drupal\views\Plugin\views\field\FieldPluginBase::buildOptionsForm方法的典型用法代码示例。如果您正苦于以下问题:PHP FieldPluginBase::buildOptionsForm方法的具体用法?PHP FieldPluginBase::buildOptionsForm怎么用?PHP FieldPluginBase::buildOptionsForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\views\Plugin\views\field\FieldPluginBase的用法示例。


在下文中一共展示了FieldPluginBase::buildOptionsForm方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildOptionsForm

  /**
   * Provide the options form.
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    // Link options.
    $form['link_photo'] = array(
      '#title' => t("Link image"),
      '#description' => t("Link the image to the album page or image page."),
      '#type' => 'radios',
      '#options' => array(
        '' => $this->t('None'),
        'album' => $this->t('Album page'),
        'image' => $this->t('Image page')
      ),
      '#default_value' => $this->options['link_photo']
    );

    // Get image styles.
    $style_options = image_style_options();
    $form['image_style'] = array(
      '#title' => $this->t('Image style'),
      '#type' => 'select',
      '#default_value' => $this->options['image_style'],
      '#options' => $style_options,
    );

    parent::buildOptionsForm($form, $form_state);
  }
开发者ID:AshishNaik021,项目名称:iimisac-d8,代码行数:28,代码来源:PhotosImage.php

示例2: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $options = array('' => t('- All -'));
     $options += JobItem::getStates();
     $form['state'] = array('#title' => t('Job item state'), '#description' => t('Count only job items of a certain state.'), '#type' => 'select', '#options' => $options, '#default_value' => $this->options['state']);
 }
开发者ID:andrewl,项目名称:andrewlnet,代码行数:10,代码来源:ItemCount.php

示例3: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     if (!empty($this->definition['float'])) {
         $form['set_precision'] = array('#type' => 'checkbox', '#title' => $this->t('Round'), '#description' => $this->t('If checked, the number will be rounded.'), '#default_value' => $this->options['set_precision']);
         $form['precision'] = array('#type' => 'textfield', '#title' => $this->t('Precision'), '#default_value' => $this->options['precision'], '#description' => $this->t('Specify how many digits to print after the decimal point.'), '#states' => array('visible' => array(':input[name="options[set_precision]"]' => array('checked' => TRUE))), '#size' => 2);
         $form['decimal'] = array('#type' => 'textfield', '#title' => $this->t('Decimal point'), '#default_value' => $this->options['decimal'], '#description' => $this->t('What single character to use as a decimal point.'), '#size' => 2);
     }
     $form['separator'] = array('#type' => 'select', '#title' => $this->t('Thousands marker'), '#options' => array('' => $this->t('- None -'), ',' => $this->t('Comma'), ' ' => $this->t('Space'), '.' => $this->t('Decimal'), '\'' => $this->t('Apostrophe')), '#default_value' => $this->options['separator'], '#description' => $this->t('What single character to use as the thousands separator.'), '#size' => 2);
     $form['format_plural'] = array('#type' => 'checkbox', '#title' => $this->t('Format plural'), '#description' => $this->t('If checked, special handling will be used for plurality.'), '#default_value' => $this->options['format_plural']);
     $form['format_plural_string'] = array('#type' => 'value', '#default_value' => $this->options['format_plural_string']);
     $plural_array = explode(LOCALE_PLURAL_DELIMITER, $this->options['format_plural_string']);
     $plurals = $this->getNumberOfPlurals($this->view->storage->get('langcode'));
     for ($i = 0; $i < $plurals; $i++) {
         $form['format_plural_values'][$i] = array('#type' => 'textfield', '#title' => $i == 0 ? $this->t('Singular form') : $this->formatPlural($i, 'First plural form', '@count. plural form'), '#default_value' => isset($plural_array[$i]) ? $plural_array[$i] : '', '#description' => $this->t('Text to use for this variant, @count will be replaced with the value.'), '#states' => array('visible' => array(':input[name="options[format_plural]"]' => array('checked' => TRUE))));
     }
     if ($plurals == 2) {
         // Simplify user interface text for the most common case.
         $form['format_plural_values'][0]['#description'] = $this->t('Text to use for the singular form, @count will be replaced with the value.');
         $form['format_plural_values'][1]['#title'] = $this->t('Plural form');
         $form['format_plural_values'][1]['#description'] = $this->t('Text to use for the plural form, @count will be replaced with the value.');
     }
     $form['prefix'] = array('#type' => 'textfield', '#title' => $this->t('Prefix'), '#default_value' => $this->options['prefix'], '#description' => $this->t('Text to put before the number, such as currency symbol.'));
     $form['suffix'] = array('#type' => 'textfield', '#title' => $this->t('Suffix'), '#default_value' => $this->options['suffix'], '#description' => $this->t('Text to put after the number, such as currency symbol.'));
     parent::buildOptionsForm($form, $form_state);
 }
开发者ID:brstde,项目名称:gap1,代码行数:28,代码来源:NumericField.php

示例4: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['range'] = array('#type' => 'textfield', '#title' => t('Range'), '#description' => t('The range of weights available to select. For
     example, a range of 20 will allow you to select a weight between -20
     and 20.'), '#default_value' => $this->options['range'], '#size' => 5);
 }
开发者ID:k-zafar,项目名称:barney_river,代码行数:10,代码来源:WeightSelector.php

示例5: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     // Only show fields that precede this one.
     $field_options = $this->getPreviousFieldLabels();
     $form['fields'] = array('#type' => 'checkboxes', '#title' => $this->t('Fields'), '#description' => $this->t('Fields to be included as links.'), '#options' => $field_options, '#default_value' => $this->options['fields']);
     $form['destination'] = array('#type' => 'checkbox', '#title' => $this->t('Include destination'), '#description' => $this->t('Include a "destination" parameter in the link to return the user to the original view upon completing the link action.'), '#default_value' => $this->options['destination']);
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:11,代码来源:Links.php

示例6: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     $form['text'] = array('#type' => 'textfield', '#title' => $this->t('Text to display'), '#default_value' => $this->options['text']);
     parent::buildOptionsForm($form, $form_state);
     // The path is set by renderLink function so don't allow to set it.
     $form['alter']['path'] = array('#access' => FALSE);
     $form['alter']['external'] = array('#access' => FALSE);
 }
开发者ID:dev981,项目名称:gaptest,代码行数:11,代码来源:Link.php

示例7: buildOptionsForm

 public function buildOptionsForm(&$form, &$form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     // Remove the checkbox
     unset($form['alter']['alter_text']);
     unset($form['alter']['text']['#states']);
     unset($form['alter']['help']['#states']);
     $form['#pre_render'][] = array($this, 'preRenderCustomForm');
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:9,代码来源:Custom.php

示例8: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     $form['text'] = ['#type' => 'textfield', '#title' => $this->t('Text to display'), '#default_value' => $this->options['text']];
     parent::buildOptionsForm($form, $form_state);
     // The path is set by ::renderLink() so we do not allow to set it.
     $form['alter'] += ['path' => [], 'query' => [], 'external' => []];
     $form['alter']['path'] += ['#access' => FALSE];
     $form['alter']['query'] += ['#access' => FALSE];
     $form['alter']['external'] += ['#access' => FALSE];
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:13,代码来源:LinkBase.php

示例9: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     foreach ($this->formats as $key => $item) {
         $options[$key] = implode('/', $item);
     }
     $form['type'] = array('#type' => 'select', '#title' => $this->t('Output format'), '#options' => $options, '#default_value' => $this->options['type']);
     $form['type_custom_true'] = array('#type' => 'textfield', '#title' => $this->t('Custom output for TRUE'), '#default_value' => $this->options['type_custom_true'], '#states' => array('visible' => array('select[name="options[type]"]' => array('value' => 'custom'))));
     $form['type_custom_false'] = array('#type' => 'textfield', '#title' => $this->t('Custom output for FALSE'), '#default_value' => $this->options['type_custom_false'], '#states' => array('visible' => array('select[name="options[type]"]' => array('value' => 'custom'))));
     $form['not'] = array('#type' => 'checkbox', '#title' => $this->t('Reverse'), '#description' => $this->t('If checked, true will be displayed as false.'), '#default_value' => $this->options['not']);
     parent::buildOptionsForm($form, $form_state);
 }
开发者ID:aWEBoLabs,项目名称:taxi,代码行数:14,代码来源:Boolean.php

示例10: buildOptionsForm

 /**
  * Overrides \Drupal\views\Plugin\views\field\FieldPluginBase::defineOptions().
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $modules = system_get_info('module');
     $names = array();
     foreach ($modules as $name => $module) {
         $names[$name] = $module['name'];
     }
     $form['data_module'] = array('#title' => $this->t('Module name'), '#type' => 'select', '#description' => $this->t('The module which sets this user data.'), '#default_value' => $this->options['data_module'], '#options' => $names);
     $form['data_name'] = array('#title' => $this->t('Name'), '#type' => 'textfield', '#description' => $this->t('The name of the data key.'), '#default_value' => $this->options['data_name']);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:14,代码来源:UserData.php

示例11: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $modules = $this->moduleHandler->getModuleList();
     $names = array();
     foreach (array_keys($modules) as $name) {
         $names[$name] = $this->moduleHandler->getName($name);
     }
     $form['data_module'] = array('#title' => $this->t('Module name'), '#type' => 'select', '#description' => $this->t('The module which sets this user data.'), '#default_value' => $this->options['data_module'], '#options' => $names);
     $form['data_name'] = array('#title' => $this->t('Name'), '#type' => 'textfield', '#description' => $this->t('The name of the data key.'), '#default_value' => $this->options['data_name']);
 }
开发者ID:eigentor,项目名称:tommiblog,代码行数:14,代码来源:UserData.php

示例12: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     if (!empty($this->definition['float'])) {
         $form['set_precision'] = array('#type' => 'checkbox', '#title' => $this->t('Round'), '#description' => $this->t('If checked, the number will be rounded.'), '#default_value' => $this->options['set_precision']);
         $form['precision'] = array('#type' => 'textfield', '#title' => $this->t('Precision'), '#default_value' => $this->options['precision'], '#description' => $this->t('Specify how many digits to print after the decimal point.'), '#states' => array('visible' => array(':input[name="options[set_precision]"]' => array('checked' => TRUE))), '#size' => 2);
         $form['decimal'] = array('#type' => 'textfield', '#title' => $this->t('Decimal point'), '#default_value' => $this->options['decimal'], '#description' => $this->t('What single character to use as a decimal point.'), '#size' => 2);
     }
     $form['separator'] = array('#type' => 'select', '#title' => $this->t('Thousands marker'), '#options' => array('' => $this->t('- None -'), ',' => $this->t('Comma'), ' ' => $this->t('Space'), '.' => $this->t('Decimal'), '\'' => $this->t('Apostrophe')), '#default_value' => $this->options['separator'], '#description' => $this->t('What single character to use as the thousands separator.'), '#size' => 2);
     $form['format_plural'] = array('#type' => 'checkbox', '#title' => $this->t('Format plural'), '#description' => $this->t('If checked, special handling will be used for plurality.'), '#default_value' => $this->options['format_plural']);
     $form['format_plural_singular'] = array('#type' => 'textfield', '#title' => $this->t('Singular form'), '#default_value' => $this->options['format_plural_singular'], '#description' => $this->t('Text to use for the singular form.'), '#states' => array('visible' => array(':input[name="options[format_plural]"]' => array('checked' => TRUE))));
     $form['format_plural_plural'] = array('#type' => 'textfield', '#title' => $this->t('Plural form'), '#default_value' => $this->options['format_plural_plural'], '#description' => $this->t('Text to use for the plural form, @count will be replaced with the value.'), '#states' => array('visible' => array(':input[name="options[format_plural]"]' => array('checked' => TRUE))));
     $form['prefix'] = array('#type' => 'textfield', '#title' => $this->t('Prefix'), '#default_value' => $this->options['prefix'], '#description' => $this->t('Text to put before the number, such as currency symbol.'));
     $form['suffix'] = array('#type' => 'textfield', '#title' => $this->t('Suffix'), '#default_value' => $this->options['suffix'], '#description' => $this->t('Text to put after the number, such as currency symbol.'));
     parent::buildOptionsForm($form, $form_state);
 }
开发者ID:Nikola-xiii,项目名称:d8intranet,代码行数:18,代码来源:NumericField.php

示例13: buildOptionsForm

 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     $date_formats = array();
     foreach ($this->dateFormatStorage->loadMultiple() as $machine_name => $value) {
         $date_formats[$machine_name] = $this->t('@name format: @date', array('@name' => $value->label(), '@date' => $this->dateFormatter->format(REQUEST_TIME, $machine_name)));
     }
     $form['date_format'] = array('#type' => 'select', '#title' => $this->t('Date format'), '#options' => $date_formats + array('custom' => $this->t('Custom'), 'raw time ago' => $this->t('Time ago'), 'time ago' => $this->t('Time ago (with "ago" appended)'), 'raw time hence' => $this->t('Time hence'), 'time hence' => $this->t('Time hence (with "hence" appended)'), 'raw time span' => $this->t('Time span (future dates have "-" prepended)'), 'inverse time span' => $this->t('Time span (past dates have "-" prepended)'), 'time span' => $this->t('Time span (with "ago/hence" appended)')), '#default_value' => isset($this->options['date_format']) ? $this->options['date_format'] : 'small');
     $form['custom_date_format'] = array('#type' => 'textfield', '#title' => $this->t('Custom date format'), '#description' => $this->t('If "Custom", see <a href="http://us.php.net/manual/en/function.date.php" target="_blank">the PHP docs</a> for date formats. Otherwise, enter the number of different time units to display, which defaults to 2.'), '#default_value' => isset($this->options['custom_date_format']) ? $this->options['custom_date_format'] : '');
     // Setup #states for all possible date_formats on the custom_date_format form element.
     foreach (array('custom', 'raw time ago', 'time ago', 'raw time hence', 'time hence', 'raw time span', 'time span', 'raw time span', 'inverse time span', 'time span') as $custom_date_possible) {
         $form['custom_date_format']['#states']['visible'][] = array(':input[name="options[date_format]"]' => array('value' => $custom_date_possible));
     }
     $form['timezone'] = array('#type' => 'select', '#title' => $this->t('Timezone'), '#description' => $this->t('Timezone to be used for date output.'), '#options' => array('' => $this->t('- Default site/user timezone -')) + system_time_zones(FALSE), '#default_value' => $this->options['timezone']);
     foreach (array_merge(array('custom'), array_keys($date_formats)) as $timezone_date_formats) {
         $form['timezone']['#states']['visible'][] = array(':input[name="options[date_format]"]' => array('value' => $timezone_date_formats));
     }
     parent::buildOptionsForm($form, $form_state);
 }
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:18,代码来源:Date.php

示例14: buildOptionsForm

 /**
  * Provide the options form.
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
 }
开发者ID:mangyfox,项目名称:magic-v2,代码行数:7,代码来源:CardBaseInstanceCount.php

示例15: buildOptionsForm

 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     $form['action_title'] = array('#type' => 'textfield', '#title' => $this->t('Action title'), '#default_value' => $this->options['action_title'], '#description' => $this->t('The title shown above the actions dropdown.'));
     $form['include_exclude'] = array('#type' => 'radios', '#title' => $this->t('Available actions'), '#options' => array('exclude' => $this->t('All actions, except selected'), 'include' => $this->t('Only selected actions')), '#default_value' => $this->options['include_exclude']);
     $form['selected_actions'] = array('#type' => 'checkboxes', '#title' => $this->t('Selected actions'), '#options' => $this->getBulkOptions(FALSE), '#default_value' => $this->options['selected_actions']);
     parent::buildOptionsForm($form, $form_state);
 }
开发者ID:HakS,项目名称:drupal8_training,代码行数:10,代码来源:BulkForm.php


注:本文中的Drupal\views\Plugin\views\field\FieldPluginBase::buildOptionsForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。