Code Coverage
 
Lines
Branches
Paths
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace Drupal\display_builder;
6
7use Drupal\Core\Config\Entity\ConfigEntityInterface;
8
9/**
10 * Provides an interface defining a Pattern preset entity type.
11 */
12interface PatternPresetInterface extends ConfigEntityInterface {
13
14  /**
15   * Get the preset group.
16   *
17   * @return string
18   *   The group
19   */
20  public function getGroup(): string;
21
22  /**
23   * Return the ready to use sources.
24   *
25   * This is not the same as DisplayBuildableInterface::getSources() because
26   * the root level is a single nestable source plugin instead of a list.
27   *
28   * @param \Drupal\Core\Plugin\Context\ContextInterface[] $contexts
29   *   (Optional) Contexts for the sources.
30   * @param bool $fillNodeId
31   *   (Optional) Set instance_id on all children. Default to TRUE.
32   *
33   * @return array
34   *   The preset data.
35   */
36  public function getSources(array $contexts = [], bool $fillNodeId = TRUE): array;
37
38  /**
39   * Get summary.
40   *
41   * The summary of a preset is the summary of its root source.
42   *
43   * @return string
44   *   The summary
45   */
46  public function getSummary(): string;
47
48  /**
49   * Get the contexts from the sources stored in the preset.
50   *
51   * @return \Drupal\Core\Plugin\Context\ContextDefinition[]
52   *   Context definitions of the sources.
53   */
54  public function getContexts(): array;
55
56  /**
57   * Check if the pattern context is compatible with the display.
58   *
59   * @param \Drupal\Core\Plugin\Context\ContextInterface[] $contexts
60   *   Contexts if already accessible, keyed by context name.
61   *
62   * @return bool
63   *   True if required, False otherwise.
64   */
65  public function areContextsSatisfied(array $contexts): bool;
66
67}