Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** @license For full copyright and license information, please see the LICENSE.md file. */ |
| 6 | |
| 7 | namespace App\Core\Grid\Widget; |
| 8 | |
| 9 | defined('AMMONLY_APP') || exit('Direct script access is forbidden.'); |
| 10 | |
| 11 | use App\Core\Engine\Domain\Model\PermissionContext; |
| 12 | use App\Core\Engine\Domain\Model\RelationGridMetadata; |
| 13 | use App\Core\Engine\Domain\Model\WidgetMetadata; |
| 14 | use Psr\Http\Message\ServerRequestInterface; |
| 15 | |
| 16 | /** |
| 17 | * Widget Renderer Interface. |
| 18 | * |
| 19 | * Contract for rendering a widget tile's inner HTML/Twig partial |
| 20 | * based on relation parameters, request query and permission context. |
| 21 | * |
| 22 | * @package App\Core\Grid\Widget |
| 23 | */ |
| 24 | interface WidgetRendererInterface |
| 25 | { |
| 26 | /** |
| 27 | * Determines if this renderer handles the given widget metadata or relation. |
| 28 | * |
| 29 | * @param WidgetMetadata $widget Widget catalog metadata. |
| 30 | * @return bool True if supported. |
| 31 | */ |
| 32 | public function supports(WidgetMetadata $widget): bool; |
| 33 | |
| 34 | /** |
| 35 | * Renders the widget content into an HTML string. |
| 36 | * |
| 37 | * @param RelationGridMetadata $relation Relation placement configuration with runtime params. |
| 38 | * @param ServerRequestInterface $request Active PSR-7 HTTP request. |
| 39 | * @param PermissionContext $context Active user security context. |
| 40 | * @return string Rendered HTML content. |
| 41 | */ |
| 42 | public function render( |
| 43 | RelationGridMetadata $relation, |
| 44 | ServerRequestInterface $request, |
| 45 | PermissionContext $context |
| 46 | ): string; |
| 47 | } |