/** * {@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'])); }
/** * {@inheritdoc} */ public function submitOptionsForm(&$form, FormStateInterface $form_state) { $content = $form_state->getValue(array('options', 'content')); $form_state->setValue(array('options', 'format'), $content['format']); $form_state->setValue(array('options', 'content'), $content['value']); parent::submitOptionsForm($form, $form_state); }
/** * {@inheritdoc} */ public function calculateDependencies() { $dependencies = parent::calculateDependencies(); // Ensure that we don't add dependencies for placeholders. // @todo Use a method to check for tokens in // https://www.drupal.org/node/2396607. if (strpos($this->options['target'], '{{') === FALSE) { if ($entity = $this->entityManager->loadEntityByConfigTarget($this->entityType, $this->options['target'])) { $dependencies[$this->entityManager->getDefinition($this->entityType)->getConfigDependencyKey()][] = $entity->getConfigDependencyName(); } } return $dependencies; }
/** * {@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); }
/** * {@inheritdoc} */ public function submitOptionsForm(&$form, FormStateInterface $form_state) { $form_state['values']['options']['format'] = $form_state['values']['options']['content']['format']; $form_state['values']['options']['content'] = $form_state['values']['options']['content']['value']; parent::submitOptionsForm($form, $form_state); }
/** * {@inheritdoc} */ public function buildOptionsForm(&$form, FormStateInterface $form_state) { parent::buildOptionsForm($form, $form_state); $form['content'] = array('#title' => $this->t('Content'), '#type' => 'text_format', '#default_value' => $this->options['content']['value'], '#rows' => 6, '#format' => isset($this->options['content']['format']) ? $this->options['content']['format'] : filter_default_format(), '#editor' => FALSE); }
/** * {@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']); }