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\Session\AccountInterface; |
| 8 | |
| 9 | /** |
| 10 | * Interface for the config form builder. |
| 11 | */ |
| 12 | interface ConfigFormBuilderInterface { |
| 13 | |
| 14 | // Storage property for the profile config entity ID. |
| 15 | // This will we used in some schema.yml, careful if you change it. |
| 16 | public const PROFILE_PROPERTY = 'profile'; |
| 17 | |
| 18 | // Storage property for the nestable list of UI Patterns 2 sources. |
| 19 | // This will we used in some schema.yml, careful if you change it. |
| 20 | public const SOURCES_PROPERTY = 'sources'; |
| 21 | |
| 22 | // Storage property for the overridden profile config entity ID. |
| 23 | // This will we used in some schema.yml, careful if you change it. |
| 24 | public const OVERRIDE_PROFILE_PROPERTY = 'override_profile'; |
| 25 | |
| 26 | // Storage property for of the override field. |
| 27 | // This will we used in some schema.yml, careful if you change it. |
| 28 | public const OVERRIDE_FIELD_PROPERTY = 'override_field'; |
| 29 | |
| 30 | /** |
| 31 | * Build form for integration with Display Builder. |
| 32 | * |
| 33 | * @param \Drupal\display_builder\DisplayBuildableInterface $buildable |
| 34 | * An entity or plugin allowing the use of Display Builder. |
| 35 | * @param bool $mandatory |
| 36 | * (Optional). Is it mandatory to use Display Builder? (for example, in |
| 37 | * Page Layouts or in Entity View display Overrides). If not mandatory, |
| 38 | * the Display Builder is activated only if a Display Builder config entity |
| 39 | * is selected. |
| 40 | * |
| 41 | * @return array |
| 42 | * A form renderable array. |
| 43 | */ |
| 44 | public function build(DisplayBuildableInterface $buildable, bool $mandatory = TRUE): array; |
| 45 | |
| 46 | /** |
| 47 | * Get profiles allowed for the user. |
| 48 | * |
| 49 | * @param \Drupal\Core\Session\AccountInterface|null $account |
| 50 | * Optional user account. Current user if empty. |
| 51 | * |
| 52 | * @return array |
| 53 | * The list of allowed profiles. |
| 54 | */ |
| 55 | public function getAllowedProfiles(?AccountInterface $account = NULL): array; |
| 56 | |
| 57 | /** |
| 58 | * Is the user allowed to use display builder? |
| 59 | * |
| 60 | * @param \Drupal\display_builder\DisplayBuildableInterface $buildable |
| 61 | * An entity allowing the use of Display Builder. |
| 62 | * @param \Drupal\Core\Session\AccountInterface|null $account |
| 63 | * Optional user account. Current user if empty. |
| 64 | * |
| 65 | * @return bool |
| 66 | * Allowed or not. |
| 67 | */ |
| 68 | public function isAllowed(DisplayBuildableInterface $buildable, ?AccountInterface $account = NULL): bool; |
| 69 | |
| 70 | } |