Drupal::hasRequest

public static Drupal::hasRequest()

Indicates if there is a currently active request object.

Return value

bool TRUE if there is a currently active request object, FALSE otherwise.

File

core/lib/Drupal.php, line 190
Contains \Drupal.

Class

Drupal
Static Service Container wrapper.

Code

public static function hasRequest() {
  // Check hasContainer() first in order to always return a Boolean.
  return static::hasContainer() && static::getContainer()->has('request_stack') && static::getContainer()->get('request_stack')->getCurrentRequest() !== NULL;
}
doc_Drupal
2016-10-29 09:02:46
Comments
Leave a Comment

Please login to continue.