By lendude on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.6.x
Introduced in version:
8.6.0
Issue links:
Description:
The \Drupal class is all about syntactic sugar in bridging our procedural code to our object-orientated code. Only the getInstanceFromDefinition method is likely to be called on \Drupal::classResolver(), so in order to make it more helpful it now allows
\Drupal::classResolver(stdClass::class)
as a shortcut for
\Drupal::classResolver()->getInstanceFromDefinition(stdClass::class)
Calling \Drupal::classResolver() without an argument will still return the class resolver like before.
Before
\Drupal::classResolver()->getInstanceFromDefinition(FieldLayoutBuilder::class)->buildForm($form, $display);
After
\Drupal::classResolver(FieldLayoutBuilder::class)->buildForm($form, $display);
Impacts:
Module developers