Sometimes I encounter a function public static function create with argumentscreate()
in plugin classes.
For example, herefor the example in the code show in https://www.sitepoint.com/tutorial-on-using-drupal-8-plugin-derivatives-effectively/Tutorial on Using Drupal 8 Plugin Derivatives Effectively we can see it.
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$container->get('entity.manager')->getStorage('node')
);
}
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static(
$container->get('entity.manager')->getStorage('node')
);
}
Could you clarify me, what is the purpose of that function is, for? What should example what it should do and where is itit's used?