function buildOptionsForm(&$form, \Drupal\Core\Form\FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['source'] = array('#type' => 'select', '#title' => t('Source of Origin Point'), '#description' => t('How do you want to enter your origin point?'), '#options' => array(), '#default_value' => $this->options['source']); $proximityHandlers = geofield_proximity_views_handlers(); foreach ($proximityHandlers as $key => $handler) { $form['source']['#options'][$key] = $handler['name']; $proximityPlugin = geofield_proximity_load_plugin($key); $proximityPlugin->options_form($form, $form_state, $this); } }
/** * {@inheritdoc} */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { // Buffer available filters. $valid_feilds = ['--none--' => $this->t('-- None --')]; // Check for valid filters. foreach ($this->view->getHandlers('field', $this->view->current_display) as $delta => $field) { if ($field['plugin_id'] === 'geolocation_field_proximity') { $valid_feilds[$delta] = $field['id']; } } // Add the Filter selector. $form['proximity_field'] = empty($valid_feilds) ? ['#markup' => $this->t('There are no proximity fields available in this display.')] : ['#type' => 'select', '#title' => $this->t('Select field.'), '#description' => $this->t('Select the field to use for sorting.'), '#options' => $valid_feilds, '#default_value' => $this->options['proximity_field']]; // Add the Drupal\views\Plugin\views\field\Numeric settings to the form. parent::buildOptionsForm($form, $form_state); }
public function adminLabel($short = FALSE) { return $this->getField(parent::adminLabel($short)); }
public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['order']['#access'] = FALSE; }
public function buildOptionsForm(&$form, &$form_state) { parent::buildOptionsForm($form, $form_state); $form['sort_within_level'] = array('#type' => 'checkbox', '#title' => t('Sort within each hierarchy level'), '#description' => t('Enable this to sort the items within each level of the hierarchy by weight and title. Warning: this may produce a slow query.'), '#default_value' => $this->options['sort_within_level']); }
public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['granularity'] = array('#type' => 'radios', '#title' => $this->t('Granularity'), '#options' => array('second' => $this->t('Second'), 'minute' => $this->t('Minute'), 'hour' => $this->t('Hour'), 'day' => $this->t('Day'), 'month' => $this->t('Month'), 'year' => $this->t('Year')), '#description' => $this->t('The granularity is the smallest unit to use when determining whether two dates are the same; for example, if the granularity is "Year" then all dates in 1999, regardless of when they fall in 1999, will be considered the same date.'), '#default_value' => $this->options['granularity']); }
/** * Constructor. * * @param array $configuration * A configuration array containing information about the plugin instance. * @param string $plugin_id * The plugin_id for the plugin instance. * @param array $plugin_definition * The plugin implementation definition. * @param \Drupal\Core\Session\AccountInterface $current_user * The current user. */ public function __construct(array $configuration, $plugin_id, array $plugin_definition, AccountInterface $current_user) { parent::__construct($configuration, $plugin_id, $plugin_definition); $this->currentUser = $current_user; }