Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function buildConfigurationForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::buildConfigurationForm($form, $form_state);
     $form['target_bundles']['#title'] = $this->t('Available Vocabularies');
     // Sorting is not possible for taxonomy terms because we use
     // \Drupal\taxonomy\TermStorageInterface::loadTree() to retrieve matches.
     $form['sort']['#access'] = FALSE;
     return $form;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function buildConfigurationForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::buildConfigurationForm($form, $form_state);
     $form['target_bundles']['#title'] = $this->t('Vocabularies');
     // @todo: Currently allow auto-create only on taxonomy terms.
     $form['auto_create'] = array('#type' => 'checkbox', '#title' => $this->t("Create referenced entities if they don't already exist"), '#default_value' => isset($this->configuration['handler_settings']['auto_create']) ? $this->configuration['handler_settings']['auto_create'] : FALSE);
     // Sorting is not possible for taxonomy terms because we use
     // \Drupal\taxonomy\TermStorageInterface::loadTree() to retrieve matches.
     $form['sort']['#access'] = FALSE;
     return $form;
 }
Exemplo n.º 3
0
 /**
  * {@inheritdoc}
  */
 public function buildConfigurationForm(array $form, FormStateInterface $form_state)
 {
     $selection_handler_settings = $this->configuration['handler_settings'];
     // Merge in default values.
     $selection_handler_settings += array('filter' => array('type' => '_none'), 'include_anonymous' => TRUE);
     $form['include_anonymous'] = array('#type' => 'checkbox', '#title' => $this->t('Include the anonymous user.'), '#default_value' => $selection_handler_settings['include_anonymous']);
     // Add user specific filter options.
     $form['filter']['type'] = array('#type' => 'select', '#title' => $this->t('Filter by'), '#options' => array('_none' => $this->t('- None -'), 'role' => $this->t('User role')), '#ajax' => TRUE, '#limit_validation_errors' => array(), '#default_value' => $selection_handler_settings['filter']['type']);
     $form['filter']['settings'] = array('#type' => 'container', '#attributes' => array('class' => array('entity_reference-settings')), '#process' => array(array('\\Drupal\\Core\\Field\\Plugin\\Field\\FieldType\\EntityReferenceItem', 'formProcessMergeParent')));
     if ($selection_handler_settings['filter']['type'] == 'role') {
         // Merge in default values.
         $selection_handler_settings['filter'] += array('role' => NULL);
         $form['filter']['settings']['role'] = array('#type' => 'checkboxes', '#title' => $this->t('Restrict to the selected roles'), '#required' => TRUE, '#options' => array_diff_key(user_role_names(TRUE), array(RoleInterface::AUTHENTICATED_ID => RoleInterface::AUTHENTICATED_ID)), '#default_value' => $selection_handler_settings['filter']['role']);
     }
     $form += parent::buildConfigurationForm($form, $form_state);
     return $form;
 }
Exemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function buildConfigurationForm(array $form, FormStateInterface $form_state)
 {
     $form = parent::buildConfigurationForm($form, $form_state);
     $form['target_bundles']['#title'] = $this->t('Content types');
     return $form;
 }