You are here

protected function FormModeManagerPermissions::buildDefaultPermissions in Form mode manager 8

Same name and namespace in other branches
  1. 8.2 src/FormModeManagerPermissions.php \Drupal\form_mode_manager\FormModeManagerPermissions::buildDefaultPermissions()

Returns a list of form mode `Default` permissions for a given entity type.

Parameters

string $entity_type_id: The entity type id.

Return value

array An associative array of permission names and descriptions.

1 call to FormModeManagerPermissions::buildDefaultPermissions()
FormModeManagerPermissions::formModeManagerPermissions in src/FormModeManagerPermissions.php
Returns an array of Form mode manager permissions.

File

src/FormModeManagerPermissions.php, line 81

Class

FormModeManagerPermissions
Provides dynamic permissions of the form_mode_manager module.

Namespace

Drupal\form_mode_manager

Code

protected function buildDefaultPermissions($entity_type_id) {
  $placeholders = [
    '%type_id' => $entity_type_id,
  ];
  return [
    "use {$entity_type_id}.default form mode" => [
      'title' => $this
        ->t('Use default form mode for %type_id entity', $placeholders),
      'description' => [
        '#prefix' => '<em>',
        '#markup' => $this
          ->t("This permission can hide defaults operation (edit/add) for <b>%type_id</b> entity.", $placeholders),
        '#suffix' => '</em>',
      ],
      'restrict access' => TRUE,
    ],
  ];
}