function WidgetBase::isDefaultValueWidget

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::isDefaultValueWidget()
  2. 10 core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::isDefaultValueWidget()
  3. 11.x core/lib/Drupal/Core/Field/WidgetBase.php \Drupal\Core\Field\WidgetBase::isDefaultValueWidget()

Returns whether the widget used for default value form.

Parameters

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

bool TRUE if a widget used to input default value, FALSE otherwise.

4 calls to WidgetBase::isDefaultValueWidget()
CommentWidget::formElement in core/modules/comment/src/Plugin/Field/FieldWidget/CommentWidget.php
Returns the form for a single field widget.
LinkWidget::formElement in core/modules/link/src/Plugin/Field/FieldWidget/LinkWidget.php
Returns the form for a single field widget.
WidgetBase::form in core/lib/Drupal/Core/Field/WidgetBase.php
Creates a form element for a field.
WidgetBase::formSingleElement in core/lib/Drupal/Core/Field/WidgetBase.php
Generates the form element for a single copy of the widget.

File

core/lib/Drupal/Core/Field/WidgetBase.php, line 593

Class

WidgetBase
Base class for 'Field widget' plugin implementations.

Namespace

Drupal\Core\Field

Code

protected function isDefaultValueWidget(FormStateInterface $form_state) {
    return (bool) $form_state->get('default_value_widget');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.