You are here

public function ModalPageService::getModalToShowByParameter in Modal 4.0.x

Same name and namespace in other branches
  1. 5.0.x src/Service/ModalPageService.php \Drupal\modal_page\Service\ModalPageService::getModalToShowByParameter()
  2. 4.1.x src/Service/ModalPageService.php \Drupal\modal_page\Service\ModalPageService::getModalToShowByParameter()

Get the modal by parameter.

Parameters

object $modal: The object modal.

string $modalParamenter: The string text of parameters.

Return value

bool Return modal or false.

1 call to ModalPageService::getModalToShowByParameter()
ModalPageService::loadModalsToShow in src/Service/ModalPageService.php
Get modal to show.

File

src/Service/ModalPageService.php, line 429

Class

ModalPageService
Modal Page Service Class.

Namespace

Drupal\modal_page\Service

Code

public function getModalToShowByParameter($modal, $modalParamenter) {
  $parameters = $modal
    ->getParameters();
  $parameters = explode(PHP_EOL, $parameters);
  foreach ($parameters as $parameter) {
    $parameter = trim($parameter);
    if ($modalParamenter == $parameter) {
      return $modal;
    }
  }
  return FALSE;
}