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\Form\FormStateInterface;
8use Drupal\ui_patterns\SourceInterface;
9
10/**
11 * Defines an interface for slot sources that support slots.
12 *
13 * @todo remove when in UI Patterns module #3571009.
14 */
15interface SourceWithSlotsInterface extends SourceInterface {
16
17  /**
18   * Gets information about the slots.
19   *
20   * @return array<string, array{'title': string, 'description'?: string}>
21   *   Information about the slots.
22   */
23  public function getSlotDefinitions(): array;
24
25  /**
26   * Gets slot path.
27   *
28   * To be used with Drupal\Component\Utility\NestedArray::setValue()
29   *
30   * @param string $slot_id
31   *   Slot ID.
32   *
33   * @return array
34   *   Each array item is a part of the path.
35   */
36  public static function getSlotPath(string $slot_id): array;
37
38  /**
39   * Get values of all slots.
40   *
41   * @return array
42   *   Keys are slot IDs. Values are a list of slot sources.
43   */
44  public function getSlotValues(): array;
45
46  /**
47   * Get value of a specific slot.
48   *
49   * @param string $slot_id
50   *   Slot ID.
51   *
52   * @return array
53   *   A list of slot sources.
54   */
55  public function getSlotValue(string $slot_id): array;
56
57  /**
58   * Set slot values.
59   *
60   * @param string $slot_id
61   *   ID of the slot to update.
62   * @param array $slot
63   *   New slot data.
64   *
65   * @return array
66   *   The updated source data.
67   */
68  public function setSlotValue(string $slot_id, array $slot): array;
69
70  /**
71   * Set slot renderable.
72   *
73   * @param array $build
74   *   Source renderable.
75   * @param string $slot_id
76   *   ID of the slot to update.
77   * @param array $slot
78   *   New slot renderable.
79   *
80   * @return array
81   *   The updated source renderable.
82   */
83  public function setSlotRenderable(array $build, string $slot_id, array $slot): array;
84
85  /**
86   * Returns a form to configure settings for the source plugins.
87   *
88   * Without the slots part, and without the plugin selector if the components
89   * implements \Drupal\ui_patterns\SourceWithChoicesInterface.
90   *
91   * @param array $form
92   *   The form where the settings form is being included in.
93   * @param \Drupal\Core\Form\FormStateInterface $form_state
94   *   The current state of the form.
95   *
96   * @return array
97   *   The form elements for the source settings.
98   */
99  public function settingsFormPropsOnly(array $form, FormStateInterface $form_state): array;
100
101}