You are here

public function LoginDestination::viewPages in Login Destination 8.2

Same name and namespace in other branches
  1. 8 src/Entity/LoginDestination.php \Drupal\login_destination\Entity\LoginDestination::viewPages()

Prepare list of pages for displaying.

Return value

string HTML view for list of paths.

Overrides LoginDestinationInterface::viewPages

File

src/Entity/LoginDestination.php, line 266

Class

LoginDestination
Defines a login destination configuration entity.

Namespace

Drupal\login_destination\Entity

Code

public function viewPages() {
  $type = $this->pages_type;
  $pages = trim($this->pages);
  if (empty($pages)) {
    if ($type == self::REDIRECT_NOT_LISTED) {
      return $this
        ->t('All pages');
    }
    return $this
      ->t('No pages');
  }
  $pages = explode("\n", preg_replace('/\\r/', '', $this->pages));
  $items = [];
  foreach ($pages as $page) {
    $items[] = $type == self::REDIRECT_NOT_LISTED ? '~ ' . $page : $page;
  }
  return $this
    ->renderItemList($items, $this
    ->t('Empty'));
}