You are here

public function ParagraphsWidget::__construct in Paragraphs 8

Constructs a ParagraphsWidget object.

Parameters

string $plugin_id: The plugin_id for the widget.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The definition of the field to which the widget is associated.

array $settings: The widget settings.

array $third_party_settings: Any third party settings.

Overrides WidgetBase::__construct

File

src/Plugin/Field/FieldWidget/ParagraphsWidget.php, line 110

Class

ParagraphsWidget
Plugin implementation of the 'entity_reference_revisions paragraphs' widget.

Namespace

Drupal\paragraphs\Plugin\Field\FieldWidget

Code

public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings) {

  // Modify settings that were set before https://www.drupal.org/node/2896115.
  if (isset($settings['edit_mode']) && $settings['edit_mode'] === 'preview') {
    $settings['edit_mode'] = 'closed';
    $settings['closed_mode'] = 'preview';
  }
  parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
}