You are here

public function GridWidget::__construct in Paragraphs grid 8

Constructs a WidgetBase 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.

\Drupal\Core\Config\ConfigFactory $config_factory: Drupal config factory.

\Drupal\Core\Session\AccountProxyInterface $current_user: Current Drupal user.

\Drupal\Core\Entity\EntityDisplayRepository $entity_display_repository: Entity display repository, to get view modes by bundle.

Overrides WidgetBase::__construct

File

src/Plugin/Field/FieldWidget/GridWidget.php, line 81

Class

GridWidget
Plugin implementation of the 'grid_widget' widget.

Namespace

Drupal\paragraphs_grid\Plugin\Field\FieldWidget

Code

public function __construct($plugin_id, $plugin_definition, FieldDefinitionInterface $field_definition, array $settings, array $third_party_settings, ConfigFactory $config_factory, AccountProxyInterface $current_user, EntityDisplayRepository $entity_display_repository) {
  parent::__construct($plugin_id, $plugin_definition, $field_definition, $settings, $third_party_settings);
  $this->moduleConfig = $config_factory
    ->get('paragraphs_grid.settings');
  $this->gridConfig = $config_factory
    ->get($this->moduleConfig
    ->get('gridtype'));
  $this->currentUser = $current_user;
  $this->entityDisplayRepository = $entity_display_repository;
}