You are here

public function PluginCollectionItemBase::getValue in Plugin 8.2

Gets the data value.

Return value

mixed The data value.

Overrides Map::getValue

File

src/Plugin/Field/FieldType/PluginCollectionItemBase.php, line 172

Class

PluginCollectionItemBase
Provides a base for plugin collection field items.

Namespace

Drupal\plugin\Plugin\Field\FieldType

Code

public function getValue() {

  // The "plugin_instance" property is the canonical value of this field item,
  // but we can only represent this item's value using the plugin instance's
  // ID and configuration. parent::getValue() skips computed properties, so we
  // must return them here.
  $plugin_type = $this
    ->getPluginType();
  return [
    'plugin_id' => $this
      ->get('plugin_id')
      ->getValue(),
    'plugin_configuration' => $this
      ->get('plugin_configuration')
      ->getValue(),
    'plugin_configuration_schema_id' => $plugin_type instanceof ConfigurablePluginTypeInterface ? $plugin_type
      ->getPluginConfigurationSchemaId($this
      ->get('plugin_id')
      ->getValue()) : 'plugin.plugin_configuration.*.*',
  ];
}