You are here

public function RoleExpireApiService::deleteDefaultDuration in Role Expire 8

Same name and namespace in other branches
  1. 2.x src/RoleExpireApiService.php \Drupal\role_expire\RoleExpireApiService::deleteDefaultDuration()

Delete default duration(s) for a role.

Parameters

string $rid: Required. The role_id to remove.

File

src/RoleExpireApiService.php, line 218

Class

RoleExpireApiService
Class RoleExpireApiService.

Namespace

Drupal\role_expire

Code

public function deleteDefaultDuration($rid) {
  $config = $this->config
    ->getEditable('role_expire.config');
  $values_raw = $config
    ->get('role_expire_default_duration_roles');
  $values = empty($values_raw) ? [] : $values_raw;
  if (isset($values[$rid])) {
    unset($values[$rid]);
  }
  $config
    ->set('role_expire_default_duration_roles', $values)
    ->save();
}