class StubFallbackPluginManager

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

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.

Hierarchy

Expanded class hierarchy of StubFallbackPluginManager

File

core/tests/Drupal/Tests/Component/Plugin/StubFallbackPluginManager.php, line 20

Namespace

Drupal\Tests\Component\Plugin
View source
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';
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
DiscoveryTrait::doGetDefinition protected function Gets a specific plugin definition.
DiscoveryTrait::hasDefinition public function
PluginManagerBase::$discovery protected property The object that discovers plugins managed by this manager.
PluginManagerBase::$factory protected property The object that instantiates plugins managed by this manager.
PluginManagerBase::$mapper protected property The object that returns the preconfigured plugin instance appropriate for a particular runtime condition.
PluginManagerBase::createInstance public function 15
PluginManagerBase::getDefinition public function Overrides DiscoveryTrait::getDefinition
PluginManagerBase::getDefinitions public function Overrides DiscoveryTrait::getDefinitions
PluginManagerBase::getDiscovery protected function Gets the plugin discovery. 1
PluginManagerBase::getFactory protected function Gets the plugin factory. 1
PluginManagerBase::getInstance public function 6
PluginManagerBase::handlePluginNotFound protected function Allows plugin managers to specify custom behavior if a plugin is not found. 1
StubFallbackPluginManager::getFallbackPluginId public function Gets a fallback id for a missing plugin. Overrides PluginManagerBase::getFallbackPluginId

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