getFallbackPluginId example


  protected function handlePluginNotFound($plugin_id, array $configuration) {
    $fallback_id = $this->getFallbackPluginId($plugin_id$configuration);
    return $this->getFactory()->createInstance($fallback_id$configuration);
  }

  /** * Gets a fallback id for a missing plugin. * * This method should be implemented in extending classes that also implement * FallbackPluginManagerInterface. It is called by * PluginManagerBase::handlePluginNotFound on the abstract class, and * therefore should be defined as well on the abstract class to prevent static * analysis errors. * * @param string $plugin_id * The ID of the missing requested plugin. * @param array $configuration * An array of configuration relevant to the plugin instance. * * @return string * The id of an existing plugin to use when the plugin does not exist. * * @throws \BadMethodCallException * If the method is not implemented in the concrete plugin manager class. */


    if ($this->filterManager->hasDefinition($plugin_id)) {
      return $plugin_id;
    }
    else {
      if (in_array(static::getSourceFilterType($value)[FilterInterface::TYPE_TRANSFORM_REVERSIBLE, FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE], TRUE)) {
        $message = sprintf('Filter %s could not be mapped to an existing filter plugin; omitted since it is a transformation-only filter. Install and configure a successor after the migration.', $plugin_id);
        $migrate_executable->saveMessage($message, MigrationInterface::MESSAGE_INFORMATIONAL);
        throw new MigrateSkipProcessException("The transformation-only filter $plugin_id was skipped.");
      }
      $fallback = $this->filterManager->getFallbackPluginId($plugin_id);

      // @see \Drupal\filter\Plugin\migrate\process\FilterSettings::transform()       $message = sprintf('Filter %s could not be mapped to an existing filter plugin; defaulting to %s and dropping all settings. Either redo the migration with the module installed that provides an equivalent filter, or modify the text format after the migration to remove this filter if it is no longer necessary.', $plugin_id$fallback);
      $migrate_executable->saveMessage($message, MigrationInterface::MESSAGE_WARNING);

      return $fallback;
    }
  }

  /** * Gets the Drupal 8 filter type for a Drupal 7 filter. * * @param string $filter_id * A Drupal 7 filter ID. * * @return int * One of: * - FilterInterface::TYPE_MARKUP_LANGUAGE * - FilterInterface::TYPE_HTML_RESTRICTOR * - FilterInterface::TYPE_TRANSFORM_REVERSIBLE * - FilterInterface::TYPE_TRANSFORM_IRREVERSIBLE * * @see \Drupal\filter\Plugin\FilterInterface::getType() */
Home | Imprint | This part of the site doesn't use cookies.