function NodeNoDefaultAuthorHooks::entityBaseFieldInfoAlter
Same name and namespace in other branches
- 11.x core/modules/node/tests/modules/node_no_default_author/src/Hook/NodeNoDefaultAuthorHooks.php \Drupal\node_no_default_author\Hook\NodeNoDefaultAuthorHooks::entityBaseFieldInfoAlter()
Implements hook_entity_base_field_info_alter().
Attributes
#[Hook('entity_base_field_info_alter')]
File
-
core/
modules/ node/ tests/ modules/ node_no_default_author/ src/ Hook/ NodeNoDefaultAuthorHooks.php, line 18
Class
- NodeNoDefaultAuthorHooks
- Hook implementations for node_no_default_author.
Namespace
Drupal\node_no_default_author\HookCode
public function entityBaseFieldInfoAlter(&$fields, EntityTypeInterface $entity_type) : void {
if ($entity_type->id() === 'node') {
$fields['uid']->setDefaultValueCallback(static::class . '::noDefaultAuthor');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.