public static function ContentEntityDeriver::create in Search API 8
Creates a new class instance.
Parameters
\Symfony\Component\DependencyInjection\ContainerInterface $container: The container to pull out services used in the fetcher.
string $base_plugin_id: The base plugin ID for the plugin ID.
Return value
static Returns an instance of this fetcher.
Overrides ContainerDeriverInterface::create
File
- src/
Plugin/ search_api/ datasource/ ContentEntityDeriver.php, line 36
Class
- ContentEntityDeriver
- Derives a datasource plugin definition for every content entity type.
Namespace
Drupal\search_api\Plugin\search_api\datasourceCode
public static function create(ContainerInterface $container, $base_plugin_id) {
$deriver = new static();
/** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
$entity_type_manager = $container
->get('entity_type.manager');
$deriver
->setEntityTypeManager($entity_type_manager);
/** @var \Drupal\Core\StringTranslation\TranslationInterface $translation */
$translation = $container
->get('string_translation');
$deriver
->setStringTranslation($translation);
return $deriver;
}