EntityTestOperationHooks.php

Same filename and directory in other branches
  1. 11.x core/modules/system/tests/modules/entity_test_operation/src/Hook/EntityTestOperationHooks.php

Namespace

Drupal\entity_test_operation\Hook

File

core/modules/system/tests/modules/entity_test_operation/src/Hook/EntityTestOperationHooks.php

View source
<?php

declare (strict_types=1);
namespace Drupal\entity_test_operation\Hook;

use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\Url;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Hook\Attribute\Hook;

/**
 * Hook implementations for entity_test_operation.
 */
class EntityTestOperationHooks {
  use StringTranslationTrait;
  
  /**
   * Implements hook_entity_operation().
   */
  public function entityOperation(EntityInterface $entity) : array {
    return [
      'test' => [
        'title' => $this->t('Front page'),
        'url' => Url::fromRoute('<front>'),
        'weight' => 0,
      ],
    ];
  }

}

Classes

Title Deprecated Summary
EntityTestOperationHooks Hook implementations for entity_test_operation.

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