TestDataTypeDeriver.php

Same filename in other branches
  1. 9 core/tests/Drupal/Tests/Core/Plugin/Fixtures/Plugin/DataType/TestDataTypeDeriver.php
  2. 8.9.x core/tests/Drupal/Tests/Core/Plugin/Fixtures/Plugin/DataType/TestDataTypeDeriver.php
  3. 10 core/tests/Drupal/Tests/Core/Plugin/Fixtures/Plugin/DataType/TestDataTypeDeriver.php

Namespace

Drupal\Tests\Core\Plugin\Fixtures\Plugin\DataType

File

core/tests/Drupal/Tests/Core/Plugin/Fixtures/Plugin/DataType/TestDataTypeDeriver.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\Core\Plugin\Fixtures\Plugin\DataType;

use Drupal\Component\Plugin\Derivative\DeriverBase;

/**
 * Provides a deriver that returns a plugin for the bare ID and one variant.
 */
class TestDataTypeDeriver extends DeriverBase {
    
    /**
     * {@inheritdoc}
     */
    public function getDerivativeDefinitions($base_plugin_definition) {
        foreach ([
            '',
            'a_variant',
        ] as $item) {
            $this->derivatives[$item] = $base_plugin_definition;
            $this->derivatives[$item]['provider'] = 'core';
        }
        return $this->derivatives;
    }

}

Classes

Title Deprecated Summary
TestDataTypeDeriver Provides a deriver that returns a plugin for the bare ID and one variant.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.