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