class NodeNoDefaultAuthorHooks

Hook implementations for node_no_default_author.

Hierarchy

Expanded class hierarchy of NodeNoDefaultAuthorHooks

File

core/modules/node/tests/modules/node_no_default_author/src/Hook/NodeNoDefaultAuthorHooks.php, line 13

Namespace

Drupal\node_no_default_author\Hook
View source
class NodeNoDefaultAuthorHooks {
  
  /**
   * Implements hook_entity_base_field_info_alter().
   */
  public function entityBaseFieldInfoAlter(&$fields, EntityTypeInterface $entity_type) : void {
    if ($entity_type->id() === 'node') {
      $fields['uid']->setDefaultValueCallback(static::class . '::noDefaultAuthor');
    }
  }
  
  /**
   * An empty callback to set for the default value callback of uid.
   */
  public static function noDefaultAuthor() : void {
  }

}

Members

Title Sort descending Modifiers Object type Summary
NodeNoDefaultAuthorHooks::entityBaseFieldInfoAlter public function Implements hook_entity_base_field_info_alter().
NodeNoDefaultAuthorHooks::noDefaultAuthor public static function An empty callback to set for the default value callback of uid.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.