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\Url;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Hook\Attribute\Hook;

/**
 * Hook implementations for entity_test_operation.
 */
class EntityTestOperationHooks {
    
    /**
     * Implements hook_entity_operation().
     */
    public function entityOperation(EntityInterface $entity) {
        return [
            'test' => [
                'title' => 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.