mergeDerivativeDefinition example

    $plugin_definition = $this->decorated->getDefinition($plugin_id, FALSE);

    [$base_plugin_id$derivative_id] = $this->decodePluginId($plugin_id);
    $base_plugin_definition = $this->decorated->getDefinition($base_plugin_id$exception_on_invalid);
    if ($base_plugin_definition) {
      $deriver = $this->getDeriver($base_plugin_id$base_plugin_definition);
      if ($deriver) {
        $derivative_plugin_definition = $deriver->getDerivativeDefinition($derivative_id$base_plugin_definition);
        // If a plugin defined itself as a derivative, merge in possible         // defaults from the derivative.         if ($derivative_id && isset($plugin_definition)) {
          $plugin_definition = $this->mergeDerivativeDefinition($plugin_definition$derivative_plugin_definition);
        }
        else {
          $plugin_definition = $derivative_plugin_definition;
        }
      }
    }

    return $plugin_definition;
  }

  /** * {@inheritdoc} * * @throws \Drupal\Component\Plugin\Exception\InvalidDeriverException * Thrown if the 'deriver' class specified in the plugin definition * does not implement \Drupal\Component\Plugin\Derivative\DeriverInterface. */
Home | Imprint | This part of the site doesn't use cookies.