StubFallbackPluginManager.php

Same filename in other branches
  1. 9 core/tests/Drupal/Tests/Component/Plugin/StubFallbackPluginManager.php
  2. 10 core/tests/Drupal/Tests/Component/Plugin/StubFallbackPluginManager.php
  3. 11.x core/tests/Drupal/Tests/Component/Plugin/StubFallbackPluginManager.php

Namespace

Drupal\Tests\Component\Plugin

File

core/tests/Drupal/Tests/Component/Plugin/StubFallbackPluginManager.php

View source
<?php

namespace Drupal\Tests\Component\Plugin;

use Drupal\Component\Plugin\FallbackPluginManagerInterface;
use Drupal\Component\Plugin\PluginManagerBase;

/**
 * Stubs \Drupal\Component\Plugin\FallbackPluginManagerInterface.
 *
 * We have to stub \Drupal\Component\Plugin\FallbackPluginManagerInterface for
 * \Drupal\Tests\Component\Plugin\PluginManagerBaseTest so that we can
 * implement ::getFallbackPluginId().
 *
 * We do this so we can have it just return the plugin ID passed to it, with
 * '_fallback' appended.
 */
class StubFallbackPluginManager extends PluginManagerBase implements FallbackPluginManagerInterface {
    
    /**
     * {@inheritdoc}
     */
    public function getFallbackPluginId($plugin_id, array $configuration = []) {
        // Minimally implement getFallbackPluginId so that we can test it.
        return $plugin_id . '_fallback';
    }

}

Classes

Title Deprecated Summary
StubFallbackPluginManager Stubs \Drupal\Component\Plugin\FallbackPluginManagerInterface.

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