class BlockAriaLandmarkRoles in Block ARIA Landmark Roles 8
Helper class for ARIA landmark roles.
Hierarchy
- class \Drupal\block_aria_landmark_roles\BlockAriaLandmarkRoles
Expanded class hierarchy of BlockAriaLandmarkRoles
2 files declare their use of BlockAriaLandmarkRoles
- BlockAriaLandmarkRolesTest.php in tests/
src/ Unit/ BlockAriaLandmarkRolesTest.php - block_aria_landmark_roles.module in ./
block_aria_landmark_roles.module - Add ARIA landmark roles to Drupal blocks.
File
- src/
BlockAriaLandmarkRoles.php, line 8
Namespace
Drupal\block_aria_landmark_rolesView source
class BlockAriaLandmarkRoles {
/**
* An array of ARIA landmark roles.
*
* @var array
*/
private $roles = [
'application',
'banner',
'complementary',
'contentinfo',
'form',
'main',
'navigation',
'search',
];
/**
* Get the defined ARIA roles.
*
* @return array
* An indexed array of roles.
*/
public static function get() {
return (new static())->roles;
}
/**
* Get the defined ARIA roles as an associative array.
*
* @return array
* An associative array of roles.
*/
public static function getAssociative() {
$self = new static();
return array_combine($self->roles, $self->roles);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BlockAriaLandmarkRoles:: |
private | property | An array of ARIA landmark roles. | |
BlockAriaLandmarkRoles:: |
public static | function | Get the defined ARIA roles. | |
BlockAriaLandmarkRoles:: |
public static | function | Get the defined ARIA roles as an associative array. |