You are here

public function RoleExpireApiService::getDefaultDuration in Role Expire 2.x

Same name and namespace in other branches
  1. 8 src/RoleExpireApiService.php \Drupal\role_expire\RoleExpireApiService::getDefaultDuration()

Get the default duration for a role.

Parameters

string $rid: Required. The role_id to check.

Return value

string String containing the strtotime compatible default duration of the role or empty string if not set.

1 call to RoleExpireApiService::getDefaultDuration()
RoleExpireApiService::processDefaultRoleDurationForUser in src/RoleExpireApiService.php
Sets the default role duration for the current user/role combination.

File

src/RoleExpireApiService.php, line 184

Class

RoleExpireApiService
Class RoleExpireApiService.

Namespace

Drupal\role_expire

Code

public function getDefaultDuration($rid) {
  $values_raw = $this->config
    ->get('role_expire.config')
    ->get('role_expire_default_duration_roles');
  $values = empty($values_raw) ? [] : $values_raw;
  $result = isset($values[$rid]) ? $values[$rid] : '';
  return !empty($result) ? $result : '';
}