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