You are here

public static function PresetFormBase::create in Video 8.2

Factory method for PresetFormBase.

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

modules/video_transcode/src/Form/PresetFormBase.php, line 60

Class

PresetFormBase
Class PresetFormBase.

Namespace

Drupal\video_transcode\Form

Code

public static function create(ContainerInterface $container) {
  return new static($container
    ->get('entity_type.manager'));
}