You are here

public static function SearchApiAlgoliaBackend::create in Search API Algolia 8

Same name and namespace in other branches
  1. 3.0.x src/Plugin/search_api/backend/SearchApiAlgoliaBackend.php \Drupal\search_api_algolia\Plugin\search_api\backend\SearchApiAlgoliaBackend::create()
  2. 2.0.x src/Plugin/search_api/backend/SearchApiAlgoliaBackend.php \Drupal\search_api_algolia\Plugin\search_api\backend\SearchApiAlgoliaBackend::create()

Creates an instance of the plugin.

Parameters

\Symfony\Component\DependencyInjection\ContainerInterface $container: The container to pull out services used in the plugin.

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin ID for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Return value

static Returns an instance of this plugin.

Overrides BackendPluginBase::create

File

src/Plugin/search_api/backend/SearchApiAlgoliaBackend.php, line 85

Class

SearchApiAlgoliaBackend
Class SearchApiAlgoliaBackend.

Namespace

Drupal\search_api_algolia\Plugin\search_api\backend

Code

public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
  $backend = new static($configuration, $plugin_id, $plugin_definition, $container
    ->get('language_manager'));

  /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */
  $module_handler = $container
    ->get('module_handler');
  $backend
    ->setModuleHandler($module_handler);

  /** @var \Psr\Log\LoggerInterface $logger */
  $logger = $container
    ->get('logger.channel.search_api_algolia');
  $backend
    ->setLogger($logger);
  return $backend;
}