You are here

public function GridFieldType::__construct in Paragraphs grid 8

Constructs a TypedData object given its definition and context.

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface $definition: The data definition.

string $name: (optional) The name of the created property, or NULL if it is the root of a typed data tree. Defaults to NULL.

\Drupal\Core\TypedData\TypedDataInterface $parent: (optional) The parent object of the data property, or NULL if it is the root of a typed data tree. Defaults to NULL.

Overrides FieldItemBase::__construct

See also

\Drupal\Core\TypedData\TypedDataManager::create()

File

src/Plugin/Field/FieldType/GridFieldType.php, line 49

Class

GridFieldType
Plugin implementation of the 'grid_field_type' field type.

Namespace

Drupal\paragraphs_grid\Plugin\Field\FieldType

Code

public function __construct(DataDefinitionInterface $definition, $name = NULL, TypedDataInterface $parent = NULL) {
  parent::__construct($definition, $name, $parent);

  /* @ToDo use dependencies injection when https://www.drupal.org/node/2053415 is fixed */
  $config_factory = \Drupal::service('config.factory');
  $this->moduleConfig = $config_factory
    ->get('paragraphs_grid.settings');
  $this->gridConfig = $config_factory
    ->get($this->moduleConfig
    ->get('gridtype'));
}