You are here

protected function EndpointAccessibilityRequirement::getTestNid in Acquia Content Hub 8

Get the Nid of a published node on the site.

Return value

int|bool Nid of a published node. FALSE if none exist.

1 call to EndpointAccessibilityRequirement::getTestNid()
EndpointAccessibilityRequirement::testContentViewEndpoint in acquia_contenthub_diagnostic/src/Plugin/ContentHubRequirement/EndpointAccessibilityRequirement.php
Test the content view endpoint.

File

acquia_contenthub_diagnostic/src/Plugin/ContentHubRequirement/EndpointAccessibilityRequirement.php, line 137

Class

EndpointAccessibilityRequirement
Defines an endpoint accessibility requirement.

Namespace

Drupal\acquia_contenthub_diagnostic\Plugin\ContentHubRequirement

Code

protected function getTestNid() {
  $nodes = \Drupal::entityQuery('node')
    ->condition('status', 1)
    ->range(0, 1)
    ->execute();
  if (count($nodes)) {
    return array_pop($nodes);
  }
  return FALSE;
}