You are here

public function PathContext::shouldAttach in Acquia Lift Connector 8.4

Same name and namespace in other branches
  1. 8 src/Service/Context/PathContext.php \Drupal\acquia_lift\Service\Context\PathContext::shouldAttach()
  2. 8.3 src/Service/Context/PathContext.php \Drupal\acquia_lift\Service\Context\PathContext::shouldAttach()

Should attach.

Return value

boolean True if should attach.

File

src/Service/Context/PathContext.php, line 90

Class

PathContext

Namespace

Drupal\acquia_lift\Service\Context

Code

public function shouldAttach() {

  // Should not attach if credential is invalid.
  if (SettingsHelper::isInvalidCredential($this->credentialSettings)) {
    return FALSE;
  }

  // Should not attach if current path match the path patterns.
  if ($this->pathMatcher
    ->match($this->currentPath, $this->requestPathPatterns)) {
    return FALSE;
  }

  // Should attach.
  return TRUE;
}