You are here

public static function PresentationFormBase::create in Isotope (with Masonry and Packery) 8

Factory method for PresentationFormBase.

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/PresentationFormBase.php, line 59
Contains Drupal\isotope\Form\PresentationFormBase.

Class

PresentationFormBase
Class PresentationFormBase.

Namespace

Drupal\isotope\Form

Code

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