當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FormatterBase::settingsForm方法代碼示例

本文整理匯總了PHP中Drupal\Core\Field\FormatterBase::settingsForm方法的典型用法代碼示例。如果您正苦於以下問題:PHP FormatterBase::settingsForm方法的具體用法?PHP FormatterBase::settingsForm怎麽用?PHP FormatterBase::settingsForm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Drupal\Core\Field\FormatterBase的用法示例。


在下文中一共展示了FormatterBase::settingsForm方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::settingsForm($form, $form_state);
     $form['check_in_date_format'] = array('#type' => 'textfield', '#title' => $this->t('Check-in date/time format'), '#description' => $this->t('See <a href=":url" target="_blank">the documentation for PHP date formats</a>.', [':url' => 'http://php.net/manual/function.date.php']), '#default_value' => $this->getSetting('check_in_date_format'));
     $form['check_out_date_format'] = array('#type' => 'textfield', '#title' => $this->t('Check-out date/time format'), '#description' => $this->t('See <a href=":url" target="_blank">the documentation for PHP date formats</a>.', [':url' => 'http://php.net/manual/function.date.php']), '#default_value' => $this->getSetting('check_out_date_format'));
     return $form;
 }
開發者ID:lokeoke,項目名稱:d8intranet,代碼行數:10,代碼來源:CheckInAndOutDefaultFormatter.php

示例2: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::settingsForm($form, $form_state);
     $entity_type = $this->entityManager->getDefinition($this->fieldDefinition->getTargetEntityTypeId());
     $form['link_to_entity'] = ['#type' => 'checkbox', '#title' => $this->t('Link to the @entity_label', ['@entity_label' => $entity_type->getLabel()]), '#default_value' => $this->getSetting('link_to_entity')];
     return $form;
 }
開發者ID:ddrozdik,項目名稱:dmaps,代碼行數:10,代碼來源:StringFormatter.php

示例3: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $element = parent::settingsForm($form, $form_state);
     $element['image_style'] = ['#title' => $this->t('Image Style'), '#type' => 'select', '#default_value' => $this->getSetting('image_style'), '#required' => FALSE, '#options' => image_style_options()];
     $element['link_image_to'] = ['#title' => $this->t('Link image to'), '#type' => 'select', '#empty_option' => $this->t('- None -'), '#default_value' => $this->getSetting('link_image_to'), '#options' => [static::LINK_CONTENT => $this->t('Content'), static::LINK_PROVIDER => $this->t('Provider URL')]];
     return $element;
 }
開發者ID:eric-shell,項目名稱:eric-shell-d8,代碼行數:10,代碼來源:Thumbnail.php

示例4: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $settings = $this->getSettings();
     $formatters = $settings['formatters'];
     $this->prepareFormatters($this->fieldDefinition->getType(), $formatters, FALSE);
     $elements['#attached']['library'][] = 'fallback_formatter/admin';
     $parents = array('fields', $this->fieldDefinition->getName(), 'settings_edit_form', 'settings', 'formatters');
     // Filter status.
     $elements['formatters']['status'] = array('#type' => 'item', '#title' => t('Enabled formatters'), '#prefix' => '<div class="fallback-formatter-status-wrapper">', '#suffix' => '</div>');
     foreach ($formatters as $name => $options) {
         $elements['formatters']['status'][$name] = array('#type' => 'checkbox', '#title' => $options['label'], '#default_value' => !empty($options['status']), '#parents' => array_merge($parents, array($name, 'status')), '#weight' => $options['weight']);
     }
     // Filter order (tabledrag).
     $elements['formatters']['order'] = array('#type' => 'item', '#title' => t('Formatter processing order'), '#theme' => 'fallback_formatter_settings_order');
     foreach ($formatters as $name => $options) {
         $elements['formatters']['order'][$name]['label'] = array('#markup' => $options['label']);
         $elements['formatters']['order'][$name]['weight'] = array('#type' => 'weight', '#title' => t('Weight for @title', array('@title' => $options['label'])), '#title_display' => 'invisible', '#delta' => 50, '#default_value' => $options['weight'], '#parents' => array_merge($parents, array($name, 'weight')));
         $elements['formatters']['order'][$name]['#weight'] = $options['weight'];
     }
     // Filter settings.
     foreach ($formatters as $name => $options) {
         $formatter_instance = $this->getFormatter($options);
         $settings_form = $formatter_instance->settingsForm($form, $form_state);
         if (!empty($settings_form)) {
             $elements['formatters']['settings'][$name] = array('#type' => 'fieldset', '#title' => $options['label'], '#parents' => array_merge($parents, array($name, 'settings')), '#weight' => $options['weight'], '#group' => 'formatter_settings');
             $elements['formatters']['settings'][$name] += $settings_form;
         }
         $elements['formatters']['settings'][$name]['formatter'] = array('#type' => 'value', '#value' => $name, '#parents' => array_merge($parents, array($name, 'formatter')));
     }
     return $elements;
 }
開發者ID:DrupalTV,項目名稱:DrupalTV,代碼行數:35,代碼來源:FallbackFormatter.php

示例5: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $enabled_plugins = array();
     $i = 0;
     foreach ($this->getSetting('provider_plugins') as $plugin_id => $plugin) {
         if ($plugin['checked']) {
             $plugin['weight'] = intval($i++);
             $enabled_plugins[$plugin_id] = $plugin;
         }
     }
     $elements['geocoder_plugins_title'] = array('#type' => 'item', '#weight' => 15, '#title' => t('Geocoder plugin(s)'), '#description' => t('Select the Geocoder plugins to use, you can reorder them. The first one to return a valid value will be used.'));
     $elements['provider_plugins'] = array('#type' => 'table', '#weight' => 20, '#header' => array(array('data' => $this->t('Enabled')), array('data' => $this->t('Weight')), array('data' => $this->t('Name'))), '#tabledrag' => array(array('action' => 'order', 'relationship' => 'sibling', 'group' => 'provider_plugins-order-weight')));
     $rows = array();
     $count = count($enabled_plugins);
     foreach (Geocoder::getPlugins('Provider') as $plugin_id => $plugin_name) {
         if (isset($enabled_plugins[$plugin_id])) {
             $weight = $enabled_plugins[$plugin_id]['weight'];
         } else {
             $weight = $count++;
         }
         $rows[$plugin_id] = array('#attributes' => array('class' => array('draggable')), '#weight' => $weight, 'checked' => array('#type' => 'checkbox', '#default_value' => isset($enabled_plugins[$plugin_id]) ? 1 : 0), 'weight' => array('#type' => 'weight', '#title' => t('Weight for @title', array('@title' => $plugin_id)), '#title_display' => 'invisible', '#default_value' => $weight, '#attributes' => array('class' => array('provider_plugins-order-weight'))), 'name' => array('#plain_text' => $plugin_name));
     }
     uasort($rows, function ($a, $b) {
         return strcmp($a['#weight'], $b['#weight']);
     });
     foreach ($rows as $plugin_id => $row) {
         $elements['provider_plugins'][$plugin_id] = $row;
     }
     $elements['dumper_plugin'] = array('#type' => 'select', '#weight' => 25, '#title' => 'Output format', '#default_value' => $this->getSetting('dumper_plugin'), '#options' => Geocoder::getPlugins('dumper'), '#description' => t('Set the output format of the value. Ex, for a geofield, the format must be set to WKT.'));
     return $elements;
 }
開發者ID:seongbae,項目名稱:drumo-distribution,代碼行數:35,代碼來源:GeocodeFormatterBase.php

示例6: settingsForm

  public function settingsForm(array $form, FormStateInterface $form_state) {
    $elements = parent::settingsForm($form, $form_state);

    $elements['keep_pdfjs'] = array(
      '#type' => 'checkbox',
      '#title' => t('Always use pdf.js'),
      '#default_value' => $this->getSetting('keep_pdfjs'),
      '#description' => t("Use pdf.js even the browser has Adobe Reader Plugin, WebKit PDF Reader for Safari or the PDF Reader for Chrome (Chrome's default alternative to the Adobe Reader Plugin) installed."),
    );

    $elements['width'] = array(
      '#type' => 'textfield',
      '#title' => 'Width',
      '#default_value' => $this->getSetting('width'),
      '#description' => t('Width of the viewer. Ex: 250px or 100%'),
    );

    $elements['height'] = array(
      '#type' => 'textfield',
      '#title' => 'Height',
      '#default_value' => $this->getSetting('height'),
      '#description' => t('Height of the viewer. Ex: 250px or 100%'),
    );
    return $elements;
  }
開發者ID:AshishNaik021,項目名稱:iimisac-d8,代碼行數:25,代碼來源:PdfDefault.php

示例7: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::settingsForm($form, $form_state);
     $form['show_quantity'] = ['#type' => 'checkbox', '#title' => t('Display a quantity input field on the add to cart form.'), '#default_value' => $this->getSetting('show_quantity')];
     $form['default_quantity'] = ['#type' => 'number', '#title' => t('Default quantity'), '#default_value' => $this->getSetting('default_quantity'), '#min' => 1, '#max' => 9999];
     $form['combine'] = ['#type' => 'checkbox', '#title' => t('Attempt to combine line items containing the same product variation.'), '#description' => t('The line item type, referenced product variation, and data from fields exposed on the Add to Cart form must all match to combine.'), '#default_value' => $this->getSetting('combine')];
     return $form;
 }
開發者ID:marmouset,項目名稱:drupal,代碼行數:11,代碼來源:AddToCartFormatter.php

示例8: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $element = parent::settingsForm($form, $form_state);
     $element += $this->thumbnailFormatter->settingsForm([], $form_state);
     $element += $this->videoFormatter->settingsForm([], $form_state);
     $element['modal_max_width'] = ['#title' => $this->t('Maximum Width'), '#type' => 'number', '#description' => $this->t('The maximum size of the video opened in the Colorbox window in pixels. For smaller screen sizes, the video will scale.'), '#required' => TRUE, '#field_suffix' => 'px', '#size' => 20, '#states' => ['visible' => [[':input[name*="responsive"]' => ['checked' => TRUE]]]], '#default_value' => $this->getSetting('modal_max_width')];
     return $element;
 }
開發者ID:nB-MDSO,項目名稱:mdso-d8blog,代碼行數:11,代碼來源:Colorbox.php

示例9: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::settingsForm($form, $form_state);
     $field_settings = $this->getFieldSettings();
     $settings = $this->getSettings();
     $form['show_interest_groups'] = array('#title' => t('Show Interest Groups'), '#type' => 'checkbox', '#description' => $field_settings['show_interest_groups'] ? t('Check to display interest group membership details.') : t('To display Interest Groups, first enable them in the field instance settings.'), '#default_value' => $field_settings['show_interest_groups'] && $settings['show_interest_groups'], '#disabled' => !$field_settings['show_interest_groups']);
     return $form;
 }
開發者ID:rafavergara,項目名稱:ddv8,代碼行數:11,代碼來源:MailchimpListsSubscribeDefaultFormatter.php

示例10: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $elements['image_style'] = array('#type' => 'select', '#title' => t('Image style'), '#options' => image_style_options(FALSE), '#default_value' => $this->getSetting('image_style'), '#empty_option' => t('None (original image)'));
     $link_types = array('content' => t('Content'), 'youtube' => t('YouTube'));
     $elements['image_link'] = array('#title' => t('Link image to'), '#type' => 'select', '#default_value' => $this->getSetting('image_link'), '#empty_option' => t('Nothing'), '#options' => $link_types);
     return $elements;
 }
開發者ID:neeravbm,項目名稱:unify-d8,代碼行數:11,代碼來源:YouTubeThumbFormatter.php

示例11: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $options = \Drupal::service('geophp.geophp')->getAdapterMap();
     unset($options['google_geocode']);
     $elements['output_format'] = array('#title' => t('Output Format'), '#type' => 'select', '#default_value' => $this->getSetting('output_format'), '#options' => $options, '#required' => TRUE);
     return $elements;
 }
開發者ID:seongbae,項目名稱:drumo-distribution,代碼行數:11,代碼來源:GeofieldDefaultFormatter.php

示例12: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $elements['trim_length'] = array('#type' => 'number', '#title' => t('Trim link text length'), '#field_suffix' => t('characters'), '#default_value' => $this->getSetting('trim_length'), '#min' => 1, '#description' => t('Leave blank to allow unlimited link text lengths.'));
     $elements['url_only'] = array('#type' => 'checkbox', '#title' => t('URL only'), '#default_value' => $this->getSetting('url_only'), '#access' => $this->getPluginId() == 'link');
     $elements['url_plain'] = array('#type' => 'checkbox', '#title' => t('Show URL as plain text'), '#default_value' => $this->getSetting('url_plain'), '#access' => $this->getPluginId() == 'link', '#states' => array('visible' => array(':input[name*="url_only"]' => array('checked' => TRUE))));
     $elements['rel'] = array('#type' => 'checkbox', '#title' => t('Add rel="nofollow" to links'), '#return_value' => 'nofollow', '#default_value' => $this->getSetting('rel'));
     $elements['target'] = array('#type' => 'checkbox', '#title' => t('Open link in new window'), '#return_value' => '_blank', '#default_value' => $this->getSetting('target'));
     return $elements;
 }
開發者ID:ravibarnwal,項目名稱:laraitassociate.in,代碼行數:13,代碼來源:LinkFormatter.php

示例13: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $elements['range_separator'] = array('#type' => 'textfield', '#title' => t('Range separator.'), '#default_value' => $this->getSetting('range_separator'), '#weight' => 0);
     $options = array('' => t('- None -'), '.' => t('Decimal point'), ',' => t('Comma'), ' ' => t('Space'), chr(8201) => t('Thin space'), "'" => t('Apostrophe'));
     $elements['thousand_separator'] = array('#type' => 'select', '#title' => t('Thousand marker'), '#options' => $options, '#default_value' => $this->getSetting('thousand_separator'), '#weight' => 1);
     $elements['range_combine'] = array('#type' => 'checkbox', '#title' => t('Combine equivalent values'), '#description' => t('If the FROM and TO values are equal, combine the display into a single value.'), '#default_value' => $this->getSetting('range_combine'), '#weight' => 10);
     $elements['from_prefix_suffix'] = array('#type' => 'checkbox', '#title' => t('Display <em>FROM value</em> prefix and suffix'), '#default_value' => $this->getSetting('from_prefix_suffix'), '#weight' => 11);
     $elements['to_prefix_suffix'] = array('#type' => 'checkbox', '#title' => t('Display <em>TO value</em> prefix and suffix'), '#default_value' => $this->getSetting('to_prefix_suffix'), '#weight' => 12);
     return $elements;
 }
開發者ID:darrylri,項目名稱:protovbmwmo,代碼行數:14,代碼來源:DefaultRangeFormatter.php

示例14: settingsForm

  /**
   * {@inheritdoc}
   */
  public function settingsForm(array $form, FormStateInterface $form_state) {
    $form = parent::settingsForm($form, $form_state);
    // We may decide on alternatives to rendering the view so get settings established
    $form['render_view'] = [
      '#type' => 'checkbox',
      '#title' => $this->t('Render View'),
      '#default_value' => $this->getSetting('render_view'),
    ];

    return $form;
  }
開發者ID:eloiv,項目名稱:botafoc.cat,代碼行數:14,代碼來源:ViewsReferenceFieldFormatter.php

示例15: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $elements['autoplay'] = ['#title' => t('Autoplay'), '#type' => 'checkbox', '#description' => $this->t('Autoplay the videos for users without the "never autoplay videos" permission. Roles with this permission will bypass this setting.'), '#default_value' => $this->getSetting('autoplay')];
     $elements['responsive'] = ['#title' => t('Responsive Video'), '#type' => 'checkbox', '#description' => $this->t("Make the video fill the width of it's container, adjusting to the size of the user's screen."), '#default_value' => $this->getSetting('responsive')];
     // Loosely match the name attribute so forms which don't have a field
     // formatter structure (such as the WYSIWYG settings form) are also matched.
     $responsive_checked_state = ['visible' => [[':input[name*="responsive"]' => ['checked' => FALSE]]]];
     $elements['width'] = ['#title' => t('Width'), '#type' => 'number', '#field_suffix' => 'px', '#default_value' => $this->getSetting('width'), '#required' => TRUE, '#size' => 20, '#states' => $responsive_checked_state];
     $elements['height'] = ['#title' => t('Height'), '#type' => 'number', '#field_suffix' => 'px', '#default_value' => $this->getSetting('height'), '#required' => TRUE, '#size' => 20, '#states' => $responsive_checked_state];
     return $elements;
 }
開發者ID:nB-MDSO,項目名稱:mdso-d8blog,代碼行數:15,代碼來源:Video.php


注:本文中的Drupal\Core\Field\FormatterBase::settingsForm方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。