Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Widgets; |
| 4 | |
| 5 | /** |
| 6 | * A block type that can be dropped into a widget area (homepage stack, |
| 7 | * footer column, sidebar). Types are registered in config/widgets.php and |
| 8 | * edited through their own schema form (same field set as Settings). |
| 9 | */ |
| 10 | interface WidgetContract |
| 11 | { |
| 12 | /** Stable machine key, e.g. "rich_text". */ |
| 13 | public function key(): string; |
| 14 | |
| 15 | /** Human label shown in the "add widget" picker. */ |
| 16 | public function label(): string; |
| 17 | |
| 18 | /** Font-awesome icon class. */ |
| 19 | public function icon(): string; |
| 20 | |
| 21 | /** One-line description for the picker. */ |
| 22 | public function description(): string; |
| 23 | |
| 24 | /** |
| 25 | * Field schema for this widget's settings form. Same shape as |
| 26 | * config/settings/*.php fields: ['key' => ['type' => 'text', 'label' => ...]]. |
| 27 | * |
| 28 | * @return array<string, array> |
| 29 | */ |
| 30 | public function fields(): array; |
| 31 | |
| 32 | /** Default settings (used on first insert). */ |
| 33 | public function defaults(): array; |
| 34 | |
| 35 | /** Render the widget to HTML for the storefront. */ |
| 36 | public function render(array $settings): string; |
| 37 | } |