FieldPermissionExampleController.php

Same filename in other branches
  1. 3.x modules/field_permission_example/src/Controller/FieldPermissionExampleController.php

Namespace

Drupal\field_permission_example\Controller

File

modules/field_permission_example/src/Controller/FieldPermissionExampleController.php

View source
<?php

namespace Drupal\field_permission_example\Controller;

use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Link;

/**
 * Controller routines for field permission example routes.
 */
class FieldPermissionExampleController extends ControllerBase {
    
    /**
     * A simple controller method to explain what this example is about.
     */
    public function description() {
        // Make a link from a route to the permissions admin page.
        $permissions_admin_link = Link::createFromRoute($this->t('the permissions admin page'), 'user.admin_permissions')
            ->toString();
        $build = [
            'description' => [
                '#theme' => 'field_permission_description',
                '#admin_link' => $permissions_admin_link,
            ],
        ];
        return $build;
    }

}

Classes

Title Deprecated Summary
FieldPermissionExampleController Controller routines for field permission example routes.