Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state)
 {
     $main_widget = parent::formElement($items, $delta, $element, $form, $form_state);
     $element = $main_widget['value'];
     $element['#type'] = 'text_format';
     $element['#format'] = $items[$delta]->format;
     $element['#base_type'] = $main_widget['value']['#type'];
     return $element;
 }
Exemple #2
0
 /**
  * {@inheritdoc}
  */
 public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state)
 {
     $main_widget = parent::formElement($items, $delta, $element, $form, $form_state);
     if ($this->getFieldSetting('text_processing')) {
         $element = $main_widget['value'];
         $element['#type'] = 'text_format';
         $element['#format'] = $items[$delta]->format;
         $element['#base_type'] = $main_widget['value']['#type'];
         return $element;
     }
     return $main_widget;
 }