defaultValueWidget example


    }

    return $constraints;
  }

  /** * {@inheritdoc} */
  public function defaultValuesForm(array &$form, FormStateInterface $form_state) {
    if (empty($this->getFieldDefinition()->getDefaultValueCallback())) {
      if ($widget = $this->defaultValueWidget($form_state)) {
        // Place the input in a separate place in the submitted values tree.         $element = ['#parents' => ['default_value_input']];
        $element += $widget->form($this$element$form_state);

        return $element;
      }
      else {
        return ['#markup' => $this->t('No widget available for: %type.', ['%type' => $this->getFieldDefinition()->getType()])];
      }
    }
  }

  
Home | Imprint | This part of the site doesn't use cookies.