You are here

public function AvailableUserRolesService::getRegistrationPages in Multiple Registration 8

Same name and namespace in other branches
  1. 8.2 src/AvailableUserRolesService.php \Drupal\multiple_registration\AvailableUserRolesService::getRegistrationPages()
  2. 3.x src/AvailableUserRolesService.php \Drupal\multiple_registration\AvailableUserRolesService::getRegistrationPages()

Get all role ids for whom registration forms was created.

Return value

mixed If registration forms exists, array of paths. In other situation - FALSE.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

File

src/AvailableUserRolesService.php, line 72

Class

AvailableUserRolesService
Class AvailableUserRolesService.

Namespace

Drupal\multiple_registration

Code

public function getRegistrationPages() {
  $roles = $this
    ->getAvailableRoles();
  if (!empty($roles)) {
    $pages_config = $this->configFactory
      ->getEditable('multiple_registration.create_registration_page_form_config');
    $reg_pages = [];
    foreach ($roles as $rid => $role_name) {
      if ($url = $pages_config
        ->get('multiple_registration_url_' . $rid)) {
        $isHidden = $pages_config
          ->get('multiple_registration_hidden_' . $rid);
        $reg_pages[$rid]['url'] = $url;
        $reg_pages[$rid]['role_name'] = $role_name;
        $reg_pages[$rid]['hidden'] = $isHidden;
      }
    }
    return $reg_pages;
  }
  return FALSE;
}