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


PHP WidgetBase::settingsForm方法代码示例

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


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

示例1: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $element = parent::settingsForm($form, $form_state);
     $element['size'] = array('#type' => 'number', '#title' => t('Size'), '#default_value' => $this->getSetting('size'), '#required' => TRUE, '#min' => 20);
     $element['placeholder'] = array('#type' => 'textfield', '#title' => t('Placeholder'), '#default_value' => $this->getSetting('placeholder'));
     return $element;
 }
开发者ID:C4AProjects,项目名称:c4apage,代码行数:10,代码来源:CountryAutocompleteWidget.php

示例2: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $elements['placeholder_isbn_13'] = array('#type' => 'textfield', '#title' => $this->t('Placeholder for ISBN 13'), '#default_value' => $this->getSetting('placeholder_isbn_13'), '#description' => $this->t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'));
     $elements['placeholder_isbn_10'] = array('#type' => 'textfield', '#title' => $this->t('Placeholder for ISBN 10'), '#default_value' => $this->getSetting('placeholder_isbn_10'), '#description' => $this->t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'));
     return $elements;
 }
开发者ID:Happyculture,项目名称:exercices,代码行数:10,代码来源:IsbnWidget.php

示例3: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $elements['field'] = array('#type' => 'select', '#weight' => 10, '#title' => $this->t('Field to use'), '#description' => $this->t('Select which field you would like to use.'), '#default_value' => $this->getSetting('field'), '#required' => TRUE, '#options' => $this->getAvailableFields());
     $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.'));
     $elements['delta_handling'] = array('#type' => 'select', '#weight' => 30, '#title' => $this->t('Multi-value input handling'), '#description' => $this->t('Should geometries from multiple inputs be: <ul><li>Matched with each input (e.g. One POINT for each address field)</li><li>Aggregated into a single MULTIPOINT geofield (e.g. One MULTIPOINT polygon from multiple address fields)</li><li>Broken up into multiple geometries (e.g. One MULTIPOINT to multiple POINTs.)</li></ul>'), '#default_value' => $this->getSetting('delta_handling'), '#options' => $this->getDeltaHandling(), '#required' => TRUE);
     return $elements;
 }
开发者ID:seongbae,项目名称:drumo-distribution,代码行数:37,代码来源:GeocodeWidgetBase.php

示例4: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $element = parent::settingsForm($form, $form_state);
     $entityDisplayRepository = \Drupal::service('entity_display.repository');
     $element['view_mode'] = array('#type' => 'select', '#options' => $entityDisplayRepository->getViewModeOptions($this->getFieldSetting('target_type')), '#title' => t('View mode'), '#default_value' => $this->getSetting('view_mode'), '#description' => t('Display the field using the formatter & settings for the field from this view mode.'));
     return $element;
 }
开发者ID:shrimala,项目名称:ahsweb,代码行数:10,代码来源:DisplayWidget.php

示例5: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $settings = $this->getSettings();
     $element = parent::settingsForm($form, $form_state);
     $element['format'] = array('#type' => 'checkboxes', '#title' => t('Display in widget'), '#description' => t('Select the elements you want to show. The elements will be concatenated when showing the field.'), '#default_value' => $settings['format'], '#options' => LanguageItem::_settingsOptions('widget'), '#required' => TRUE);
     return $element;
 }
开发者ID:dev981,项目名称:gaptest,代码行数:10,代码来源:LanguageSelectWidget.php

示例6: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $entityFieldDefinitions = \Drupal::entityManager()->getFieldDefinitions($this->fieldDefinition->entity_type, $this->fieldDefinition->bundle);
     $options = array();
     foreach ($entityFieldDefinitions as $id => $definition) {
         if ($definition->getType() == 'geofield') {
             $options[$id] = $definition->getLabel();
         }
     }
     $elements['destination_field'] = array('#type' => 'select', '#title' => $this->t('Destination Geo Field'), '#default_value' => $this->getSetting('destination_field'), '#required' => TRUE, '#options' => $options);
     $elements['placeholder'] = array('#type' => 'textfield', '#title' => t('Placeholder'), '#default_value' => $this->getSetting('placeholder'), '#description' => t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'));
     return $elements;
 }
开发者ID:seongbae,项目名称:drumo-distribution,代码行数:17,代码来源:GeocoderWidget.php

示例7: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $elements['placeholder_url'] = array('#type' => 'textfield', '#title' => $this->t('Placeholder for URL'), '#default_value' => $this->getSetting('placeholder_url'), '#description' => $this->t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'));
     $elements['placeholder_title'] = array('#type' => 'textfield', '#title' => $this->t('Placeholder for link text'), '#default_value' => $this->getSetting('placeholder_title'), '#description' => $this->t('Text that will be shown inside the field until a value is entered. This hint is usually a sample value or a brief description of the expected format.'), '#states' => array('invisible' => array(':input[name="instance[settings][title]"]' => array('value' => DRUPAL_DISABLED))));
     return $elements;
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:10,代码来源:LinkWidget.php

示例8: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     $elements['html5_geolocation'] = array('#type' => 'checkbox', '#title' => 'Use HTML5 Geolocation to set default values', '#default_value' => $this->getSetting('html5_geolocation'));
     return $elements;
 }
开发者ID:seongbae,项目名称:drumo-distribution,代码行数:9,代码来源:GeofieldLatLonWidget.php

示例9: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $element = parent::settingsForm($form, $form_state);
     $browsers = [];
     /** @var \Drupal\entity_browser\EntityBrowserInterface $browser */
     foreach ($this->entityManager->getStorage('entity_browser')->loadMultiple() as $browser) {
         $browsers[$browser->id()] = $browser->label();
     }
     $element['entity_browser'] = ['#title' => t('Entity browser'), '#type' => 'select', '#default_value' => $this->getSetting('entity_browser'), '#options' => $browsers];
     $target_type = $this->fieldDefinition->getFieldStorageDefinition()->getSetting('target_type');
     $entity_type = \Drupal::entityTypeManager()->getStorage($target_type)->getEntityType();
     $displays = [];
     foreach ($this->fieldDisplayManager->getDefinitions() as $id => $definition) {
         if ($this->fieldDisplayManager->createInstance($id)->isApplicable($entity_type)) {
             $displays[$id] = $definition['label'];
         }
     }
     $id = Html::getUniqueId('field-' . $this->fieldDefinition->getName() . '-display-settings-wrapper');
     $element['field_widget_display'] = ['#title' => t('Entity display plugin'), '#type' => 'select', '#default_value' => $this->getSetting('field_widget_display'), '#options' => $displays, '#ajax' => ['callback' => array($this, 'updateSettingsAjax'), 'wrapper' => $id]];
     $element['field_widget_edit'] = ['#title' => t('Display Edit button'), '#type' => 'checkbox', '#default_value' => $this->getSetting('field_widget_edit')];
     $element['field_widget_remove'] = ['#title' => t('Display Remove button'), '#type' => 'checkbox', '#default_value' => $this->getSetting('field_widget_remove')];
     $element['open'] = ['#title' => t('Show widget details as open by default'), '#type' => 'checkbox', '#default_value' => $this->getSetting('open')];
     $element['field_widget_display_settings'] = ['#type' => 'fieldset', '#title' => t('Entity display plugin configuration'), '#tree' => TRUE, '#prefix' => '<div id="' . $id . '">', '#suffix' => '</div>'];
     if ($this->getSetting('field_widget_display')) {
         $element['field_widget_display_settings'] += $this->fieldDisplayManager->createInstance($form_state->getValue(['fields', $this->fieldDefinition->getName(), 'settings_edit_form', 'settings', 'field_widget_display'], $this->getSetting('field_widget_display')), $form_state->getValue(['fields', $this->fieldDefinition->getName(), 'settings_edit_form', 'settings', 'field_widget_display_settings'], $this->getSetting('field_widget_display_settings')) + ['entity_type' => $this->fieldDefinition->getFieldStorageDefinition()->getSetting('target_type')])->settingsForm($form, $form_state);
     }
     return $element;
 }
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:31,代码来源:EntityReference.php

示例10: settingsForm

 /**
  * {@inheritdoc}
  */
 function settingsForm(array $form, FormStateInterface $form_state)
 {
     $element = parent::settingsForm($form, $form_state);
     $element['date_order'] = array('#type' => 'select', '#title' => t('Date part order'), '#default_value' => $this->getSetting('date_order'), '#options' => array('MDY' => t('Month/Day/Year'), 'DMY' => t('Day/Month/Year'), 'YMD' => t('Year/Month/Day')));
     if ($this->getFieldSetting('datetime_type') == 'datetime') {
         $element['time_type'] = array('#type' => 'select', '#title' => t('Time type'), '#default_value' => $this->getSetting('time_type'), '#options' => array('24' => t('24 hour time'), '12' => t('12 hour time')));
     } else {
         $element['time_type'] = array('#type' => 'hidden', '#value' => 'none');
     }
     $element['increment'] = array('#type' => 'select', '#title' => t('Time increments'), '#default_value' => $this->getSetting('increment'), '#options' => array(1 => t('1 minute'), 5 => t('5 minute'), 10 => t('10 minute'), 15 => t('15 minute'), 30 => t('30 minute')));
     return $element;
 }
开发者ID:anatalsceo,项目名称:en-classe,代码行数:15,代码来源:DateTimeDatelistWidget.php

示例11: settingsForm

 /**
  * {@inheritdoc}
  */
 public function settingsForm(array $form, FormStateInterface $form_state)
 {
     $elements = parent::settingsForm($form, $form_state);
     return $elements;
 }
开发者ID:studio-fonkel,项目名称:bbox,代码行数:8,代码来源:LeafletDrawWidget.php


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