You are here

protected function LinkStatusHandlerBase::getItems in Link checker 8

Gets list of items to queue.

List should be like: [ [ 'entity_type' => 'node', 'entity_id' => 123, 'link_id' => 12 ], ... [ 'entity_type' => 'paragraph', 'entity_id' => 1234, 'link_id' => 123 ], ]

Parameters

\Drupal\linkchecker\LinkCheckerLinkInterface $link: The link.

\Psr\Http\Message\ResponseInterface $response: The response of link checking.

Return value

array Array of items.

3 calls to LinkStatusHandlerBase::getItems()
LinkStatusHandlerBase::queueItems in src/Plugin/LinkStatusHandlerBase.php
Creates a queue for handling.
Repair301::getItems in src/Plugin/LinkStatusHandler/Repair301.php
Gets list of items to queue.
Unpublish404::getItems in src/Plugin/LinkStatusHandler/Unpublish404.php
Gets list of items to queue.
2 methods override LinkStatusHandlerBase::getItems()
Repair301::getItems in src/Plugin/LinkStatusHandler/Repair301.php
Gets list of items to queue.
Unpublish404::getItems in src/Plugin/LinkStatusHandler/Unpublish404.php
Gets list of items to queue.

File

src/Plugin/LinkStatusHandlerBase.php, line 164

Class

LinkStatusHandlerBase
Base class for Link status handler plugins.

Namespace

Drupal\linkchecker\Plugin

Code

protected function getItems(LinkCheckerLinkInterface $link, ResponseInterface $response) {
  $linkStorage = $this->entityTypeManager
    ->getStorage($link
    ->getEntityTypeId());
  $query = $linkStorage
    ->getQuery();
  $query
    ->condition('urlhash', $link
    ->getHash());
  $linkIds = $query
    ->execute();
  return array_chunk($linkIds, $this->itemsPerBatch, TRUE);
}