1<?php
2
3namespace Drupal\layout_builder;
4
5use Drupal\Core\Entity\EntityInterface;
6
7/**
8 * Defines an interface for tracking inline block usage.
9 */
10interface InlineBlockUsageInterface {
11
12  /**
13   * Adds a usage record.
14   *
15   * @param int $block_content_id
16   *   The block content ID.
17   * @param \Drupal\Core\Entity\EntityInterface $entity
18   *   The layout entity.
19   */
20  public function addUsage($block_content_id, EntityInterface $entity);
21
22  /**
23   * Gets unused inline block IDs.
24   *
25   * @param int $limit
26   *   The maximum number of block content entity IDs to return.
27   *
28   * @return int[]
29   *   The entity IDs.
30   */
31  public function getUnused($limit = 100);
32
33  /**
34   * Remove usage record by layout entity.
35   *
36   * @param \Drupal\Core\Entity\EntityInterface $entity
37   *   The layout entity.
38   */
39  public function removeByLayoutEntity(EntityInterface $entity);
40
41  /**
42   * Delete the inline blocks' the usage records.
43   *
44   * @param int[] $block_content_ids
45   *   The block content entity IDs.
46   */
47  public function deleteUsage(array $block_content_ids);
48
49  /**
50   * Gets usage record for inline block by ID.
51   *
52   * @param int $block_content_id
53   *   The block content entity ID.
54   *
55   * @return object
56   *   The usage record with properties layout_entity_id and layout_entity_type.
57   */
58  public function getUsage($block_content_id);
59
60}
61