You are here

public function ModalPage::checkModalToShow in Modal 8

Same name and namespace in other branches
  1. 8.3 src/ModalPage.php \Drupal\modal_page\ModalPage::checkModalToShow()
  2. 8.2 src/ModalPage.php \Drupal\modal_page\ModalPage::checkModalToShow()

Function to check Modal will show.

File

src/ModalPage.php, line 48

Class

ModalPage
Modal Page Class.

Namespace

Drupal\modal_page

Code

public function checkModalToShow() {
  $modal = FALSE;
  $config = $this->configFactory
    ->get('modal_page.settings');
  $modals_by_page = $config
    ->get('modals');
  $modals_by_parameter = $config
    ->get('modals_by_parameter');
  if (empty($modals_by_page) && empty($modals_by_parameter)) {
    return FALSE;
  }
  if ($modals_by_page) {
    $modal = $this
      ->getModalByPage($modals_by_page);
  }
  if (empty($modal) && $modals_by_parameter) {
    $modal = $this
      ->getModalByParameter($modals_by_parameter);
  }
  return $modal;
}