public static function AutocompletionConfigurationFormBase::create in Search Autocomplete 8
Same name and namespace in other branches
- 2.x src/Form/AutocompletionConfigurationFormBase.php \Drupal\search_autocomplete\Form\AutocompletionConfigurationFormBase::create()
Factory method for AutocompletionConfigurationFormBase.
When Drupal builds this class it does not call the constructor directly. Instead, it relies on this method to build the new object. Why? The class constructor may take multiple arguments that are unknown to Drupal. The create() method always takes one parameter -- the container. The purpose of the create() method is twofold: It provides a standard way for Drupal to construct the object, meanwhile it provides you a place to get needed constructor parameters from the container.
In this case, we ask the container for an entity query factory. We then pass the factory to our class as a constructor parameter.
Overrides FormBase::create
File
- src/
Form/ AutocompletionConfigurationFormBase.php, line 59
Class
- AutocompletionConfigurationFormBase
- Class AutocompletionConfigurationFormBase.
Namespace
Drupal\search_autocomplete\FormCode
public static function create(ContainerInterface $container) {
return new static($container
->get('entity.manager')
->getStorage('autocompletion_configuration'));
}