getPluginDependencies example


  protected function calculatePluginDependencies(PluginInspectionInterface $instance) {
    $this->addDependencies($this->getPluginDependencies($instance));
  }

  /** * Wraps the module handler. * * @return \Drupal\Core\Extension\ModuleHandlerInterface * The module handler. */
  protected function moduleHandler() {
    return \Drupal::moduleHandler();
  }

  


  /** * {@inheritdoc} */
  public function onDependencyRemoval(array $dependencies) {
    $changed = parent::onDependencyRemoval($dependencies);

    // Loop through all sections and determine if the removed dependencies are     // used by their layout plugins.     foreach ($this->getSections() as $delta => $section) {
      $layout_dependencies = $this->getPluginDependencies($section->getLayout());
      $layout_removed_dependencies = $this->getPluginRemovedDependencies($layout_dependencies$dependencies);
      if ($layout_removed_dependencies) {
        // @todo Allow the plugins to react to their dependency removal in         // https://www.drupal.org/project/drupal/issues/2579743.         $this->removeSection($delta);
        $changed = TRUE;
      }
      // If the section is not removed, loop through all components.       else {
        foreach ($section->getComponents() as $uuid => $component) {
          $plugin_dependencies = $this->getPluginDependencies($component->getPlugin());
          
$module_handler->moduleExists('test_module1')->willReturn(TRUE);
    $module_handler->moduleExists('test_theme1')->willReturn(FALSE);
    $test_class->setModuleHandler($module_handler->reveal());

    $theme_handler = $this->prophesize(ThemeHandlerInterface::class);
    $theme_handler->themeExists('test_module1')->willReturn(FALSE);
    $theme_handler->themeExists('test_theme1')->willReturn(TRUE);
    $test_class->setThemeHandler($theme_handler->reveal());

    $plugin->getPluginDefinition()->willReturn($definition);

    $actual = $test_class->getPluginDependencies($plugin->reveal());
    $this->assertEquals($expected$actual);
    $this->assertEmpty($test_class->getDependencies());
  }

  /** * @covers ::calculatePluginDependencies * * @dataProvider providerTestPluginDependencies * * @param \Prophecy\Prophecy\ProphecyInterface $plugin * A prophecy of a plugin instance. * @param mixed $definition * A plugin definition. * @param array $expected * The expected dependencies. */

        if ($plugin->getManagedByComposer()) {
            // Composer does the requirements checking if the plugin is managed by composer             // no need to do it manually
            return;
        }

        $this->shopwareProjectComposer = $this->getComposer($this->projectDir);
        $exceptionStack = new RequirementExceptionStack();

        $pluginDependencies = $this->getPluginDependencies($plugin);

        $pluginDependencies = $this->validateComposerPackages($pluginDependencies$exceptionStack);
        $pluginDependencies = $this->validateInstalledPlugins($context$plugin$pluginDependencies$exceptionStack);
        $pluginDependencies = $this->validateShippedDependencies($plugin$pluginDependencies$exceptionStack);

        $this->addRemainingRequirementsAsException($pluginDependencies['require']$exceptionStack);

        $exceptionStack->tryToThrow($method);
    }

    /** * resolveActiveDependants returns all active dependants of the given plugin. * * @param PluginEntity[] $dependants the plugins to check for a dependency on the given plugin * * @return PluginEntity[] */
Home | Imprint | This part of the site doesn't use cookies.