You are here

public function LoginDestination::viewPages in Login Destination 8

Same name and namespace in other branches
  1. 8.2 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 252

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 t('All pages');
    }
    return 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, t('Empty'));
}