You are here

protected function UserFlagType::getExtraPermissionsOwner in Flag 8.4

Defines permissions for the 'owner' set of additional action permissions.

Parameters

\Drupal\flag\FlagInterface $flag: The flag object.

Return value

array An array of permissions.

Overrides EntityFlagType::getExtraPermissionsOwner

File

src/Plugin/Flag/UserFlagType.php, line 93

Class

UserFlagType
Provides a flag type for user entities.

Namespace

Drupal\flag\Plugin\Flag

Code

protected function getExtraPermissionsOwner(FlagInterface $flag) {
  $permissions['flag ' . $flag
    ->id() . ' own user account'] = [
    'title' => $this
      ->t('Flag %flag_title own profile', [
      '%flag_title' => $flag
        ->label(),
    ]),
  ];
  $permissions['unflag ' . $flag
    ->id() . ' own user account'] = [
    'title' => $this
      ->t('Unflag %flag_title own profile', [
      '%flag_title' => $flag
        ->label(),
    ]),
  ];
  $permissions['flag ' . $flag
    ->id() . ' other user accounts'] = [
    'title' => $this
      ->t("Flag %flag_title others' profiles", [
      '%flag_title' => $flag
        ->label(),
    ]),
  ];
  $permissions['unflag ' . $flag
    ->id() . ' other user accounts'] = [
    'title' => $this
      ->t("Unflag %flag_title others' profiles", [
      '%flag_title' => $flag
        ->label(),
    ]),
  ];
  return $permissions;
}