findDefinitions example

/** * {@inheritdoc} */
  protected function providerExists($provider) {
    return $this->moduleHandler->moduleExists($provider) || $this->themeHandler->themeExists($provider);
  }

  /** * {@inheritdoc} */
  protected function findDefinitions() {
    $definitions = parent::findDefinitions();

    // At this point the plugin list only contains valid plugins. Ensure all     // related plugins exist and the relationship is bi-directional. This     // ensures topics are listed on their related topics.     foreach ($definitions as $plugin_id => $plugin_definition) {
      foreach ($plugin_definition['related'] as $key => $related_id) {
        // If the related help topic does not exist it might be for a module         // that is not installed. Remove it.         // @todo Discuss this more as this could cause silent errors but it         // offers useful functionality to relate to help topic provided by         // extensions that are yet to be installed.

  protected function alterInfo($alter_hook) {
    $this->alterHook = $alter_hook;
  }

  /** * {@inheritdoc} */
  public function getDefinitions() {
    $definitions = $this->getCachedDefinitions();
    if (!isset($definitions)) {
      $definitions = $this->findDefinitions();
      $this->setCachedDefinitions($definitions);
    }
    return $definitions;
  }

  /** * {@inheritdoc} */
  public function clearCachedDefinitions() {
    if ($this->cacheBackend) {
      if ($this->cacheTags) {
        
$this->contextHandler = $context_handler;

    $this->alterInfo('layout_builder_section_storage');
    $this->setCacheBackend($cache_backend, 'layout_builder_section_storage_plugins');
  }

  /** * {@inheritdoc} */
  protected function findDefinitions() {
    $definitions = parent::findDefinitions();

    // Sort the definitions by their weight while preserving the original order     // for those with matching weights.     $weights = array_map(function DSectionStorageDefinition $definition) {
      return $definition->getWeight();
    }$definitions);
    $ids = array_keys($definitions);
    array_multisort($weights$ids$definitions);
    return $definitions;
  }

  
foreach (['core', 'source_module', 'destination_module'] as $required_property) {
      if (empty($definition[$required_property])) {
        throw new BadPluginDefinitionException($plugin_id$required_property);
      }
    }
  }

  /** * {@inheritdoc} */
  protected function findDefinitions() {
    $definitions = parent::findDefinitions();
    $this->sortDefinitions($definitions);
    return $definitions;
  }

  /** * Sorts a definitions array. * * This sorts the definitions array first by the weight column, and then by * the plugin ID, ensuring a stable, deterministic, and testable ordering of * plugins. * * @param array $definitions * The definitions array to sort. */
Home | Imprint | This part of the site doesn't use cookies.