You are here

protected function ExtraFieldViewsPlugin::getViewArguments in Entity Extra Field 2.0.x

Same name and namespace in other branches
  1. 8 src/Plugin/ExtraFieldType/ExtraFieldViewsPlugin.php \Drupal\entity_extra_field\Plugin\ExtraFieldType\ExtraFieldViewsPlugin::getViewArguments()

Get the view arguments.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity instance.

Return value

array An array of view arguments.

Throws

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to ExtraFieldViewsPlugin::getViewArguments()
ExtraFieldViewsPlugin::renderView in src/Plugin/ExtraFieldType/ExtraFieldViewsPlugin.php
Render the view.

File

src/Plugin/ExtraFieldType/ExtraFieldViewsPlugin.php, line 183

Class

ExtraFieldViewsPlugin
Define extra field views plugin.

Namespace

Drupal\entity_extra_field\Plugin\ExtraFieldType

Code

protected function getViewArguments(EntityInterface $entity) : array {
  $configuration = $this
    ->getConfiguration();
  if (!isset($configuration['arguments']) || empty($configuration['arguments'])) {
    return [];
  }
  $arguments = array_filter(explode(',', $configuration['arguments']));
  foreach ($arguments as &$argument) {
    $argument = $this
      ->processEntityToken($argument, $entity);
  }
  return $arguments;
}