/** * {@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; }
/** * {@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; }
/** * {@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; }
/** * {@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; }
/** * {@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; }
/** * {@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; }
/** * {@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; }
/** * {@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; }
/** * {@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; }
/** * {@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; }
/** * {@inheritdoc} */ public function settingsForm(array $form, FormStateInterface $form_state) { $elements = parent::settingsForm($form, $form_state); return $elements; }