Example #1
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['view_mode'] = array('#type' => 'select', '#options' => \Drupal::entityManager()->getViewModeOptions($this->entityType), '#title' => t('View mode'), '#default_value' => $this->options['view_mode']);
     $form['entity_id'] = array('#title' => t('ID'), '#type' => 'textfield', '#default_value' => $this->options['entity_id']);
     $form['bypass_access'] = array('#type' => 'checkbox', '#title' => t('Bypass access checks'), '#description' => t('If enabled, access permissions for rendering the entity are not checked.'), '#default_value' => !empty($this->options['bypass_access']));
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['view_mode'] = array('#type' => 'select', '#options' => $this->entityManager->getViewModeOptions($this->entityType), '#title' => $this->t('View mode'), '#default_value' => $this->options['view_mode']);
     $label = $this->entityManager->getDefinition($this->entityType)->getLabel();
     $target = $this->options['target'];
     // If the target does not contain tokens, try to load the entity and
     // display the entity ID to the admin form user.
     // @todo Use a method to check for tokens in
     //   https://www.drupal.org/node/2396607.
     if (strpos($this->options['target'], '{{') === FALSE) {
         // @todo If the entity does not exist, this will will show the config
         //   target identifier. Decide if this is the correct behavior in
         //   https://www.drupal.org/node/2415391.
         if ($target_entity = $this->entityManager->loadEntityByConfigTarget($this->entityType, $this->options['target'])) {
             $target = $target_entity->id();
         }
     }
     $form['target'] = ['#title' => $this->t('@entity_type_label ID', ['@entity_type_label' => $label]), '#type' => 'textfield', '#default_value' => $target];
     $form['bypass_access'] = array('#type' => 'checkbox', '#title' => $this->t('Bypass access checks'), '#description' => $this->t('If enabled, access permissions for rendering the entity are not checked.'), '#default_value' => !empty($this->options['bypass_access']));
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['content'] = array('#title' => $this->t('Content'), '#type' => 'textarea', '#default_value' => $this->options['content'], '#rows' => 6);
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['content'] = array('#title' => t('Content'), '#type' => 'text_format', '#default_value' => $this->options['content'], '#rows' => 6, '#format' => isset($this->options['format']) ? $this->options['format'] : filter_default_format(), '#editor' => FALSE);
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public function buildOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::buildOptionsForm($form, $form_state);
     $form['content'] = array('#title' => $this->t('Heading'), '#type' => 'textfield', '#default_value' => $this->options['content']);
     $form['pager_embed'] = array('#title' => $this->t('Use Pager'), '#type' => 'checkbox', '#default_value' => $this->options['pager_embed']);
 }