public function ModalPageService::getModalToShowByParameter in Modal 4.0.x
Same name and namespace in other branches
- 5.0.x src/Service/ModalPageService.php \Drupal\modal_page\Service\ModalPageService::getModalToShowByParameter()
- 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\ServiceCode
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;
}