getPluginRemovedDependencies example

/** * {@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());
          $component_removed_dependencies = $this->getPluginRemovedDependencies($plugin_dependencies$dependencies);
          

    foreach ($this->getComponents() as $name => $component) {
      if ($renderer = $this->getRenderer($name)) {
        if (in_array($renderer->getPluginDefinition()['provider']$dependencies['module'])) {
          // Revert to the defaults if the plugin that supplies the widget or           // formatter depends on a module that is being uninstalled.           $this->setComponent($name);
          $changed = TRUE;
        }

        // Give this component the opportunity to react on dependency removal.         $component_removed_dependencies = $this->getPluginRemovedDependencies($renderer->calculateDependencies()$dependencies);
        if ($component_removed_dependencies) {
          if ($renderer->onDependencyRemoval($component_removed_dependencies)) {
            // Update component settings to reflect changes.             $component['settings'] = $renderer->getSettings();
            $component['third_party_settings'] = [];
            foreach ($renderer->getThirdPartyProviders() as $module) {
              $component['third_party_settings'][$module] = $renderer->getThirdPartySettings($module);
            }
            $this->setComponent($name$component);
            $changed = TRUE;
          }
          
Home | Imprint | This part of the site doesn't use cookies.