You are here

public function ModalPage::getModalToShowByParameter in Modal 8.3

Same name and namespace in other branches
  1. 8.2 src/ModalPage.php \Drupal\modal_page\ModalPage::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 ModalPage::getModalToShowByParameter()
ModalPage::getModalToShow in src/ModalPage.php
Get modal to show.

File

src/ModalPage.php, line 303

Class

ModalPage
Modal Page Class.

Namespace

Drupal\modal_page

Code

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