/**
  * {@inheritdoc}
  */
 public function form(FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta = NULL)
 {
     $ret = parent::form($items, $form, $form_state, $get_delta);
     $field_name = $this->fieldDefinition->getName();
     // Add a new wrapper around all the elements for Ajax replacement.
     $ret['#prefix'] = '<div id="' . $field_name . '-ajax-wrapper">';
     $ret['#suffix'] = '</div>';
     return $ret;
 }
 /**
  * {@inheritdoc}
  */
 public function form(FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta = NULL)
 {
     if ($this->canBuildForm($form_state)) {
         return parent::form($items, $form, $form_state, $get_delta);
     }
     return [];
 }
 /**
  * {@inheritdoc}
  */
 public function form(FieldItemListInterface $items, array &$form, FormStateInterface $form_state, $get_delta = NULL)
 {
     $parents = $form['#parents'];
     // Identify the manage field settings default value form.
     if (in_array('default_value_input', $parents, TRUE)) {
         // Since the entity is not reusable neither cloneable, having a default
         // value is not supported.
         return ['#markup' => $this->t('No widget available for: %label.', ['%label' => $items->getFieldDefinition()->getLabel()])];
     }
     return parent::form($items, $form, $form_state, $get_delta);
 }