public FilterPermissions::permissions()
Returns an array of filter permissions.
Return value
array
File
- core/modules/filter/src/FilterPermissions.php, line 46
Class
- FilterPermissions
- Provides dynamic permissions of the filter module.
Namespace
Drupal\filter
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | public function permissions() { $permissions = []; // Generate permissions for each text format. Warn the administrator that any // of them are potentially unsafe. /** @var \Drupal\filter\FilterFormatInterface[] $formats */ $formats = $this ->entityManager->getStorage( 'filter_format' )->loadByProperties([ 'status' => TRUE]); uasort( $formats , 'Drupal\Core\Config\Entity\ConfigEntityBase::sort' ); foreach ( $formats as $format ) { if ( $permission = $format ->getPermissionName()) { $permissions [ $permission ] = [ 'title' => $this ->t( 'Use the <a href=":url">@label</a> text format' , [ ':url' => $format ->url(), '@label' => $format ->label()]), 'description' => [ '#prefix' => '<em>' , '#markup' => $this ->t( 'Warning: This permission may have security implications depending on how the text format is configured.' ), '#suffix' => '</em>' ], ]; } } return $permissions ; } |
Please login to continue.