Debian Codegraph @

vendor/ipl/web/src/Common/ItemRenderer.php

raw
1 <?php
2
3 namespace ipl\Web\Common;
4
5 use ipl\Html\Attributes;
6 use ipl\Html\HtmlDocument;
7
8 /**
9 * Interface for item renderers
10 *
11 * @template Item
12 */
13 interface ItemRenderer
14 {
15 /**
16 * Assemble the attributes for an item
17 *
18 * @param Item $item The item to render
19 * @param Attributes $attributes
20 * @param string $layout The name of the layout
21 *
22 * @return void
23 */
24 public function assembleAttributes($item, Attributes $attributes, string $layout): void;
25
26 /**
27 * Assemble a visual representation of an item
28 *
29 * @param Item $item The item to render
30 * @param HtmlDocument $visual The container to add the result to
31 * @param string $layout The name of the layout
32 *
33 * @return void
34 */
35 public function assembleVisual($item, HtmlDocument $visual, string $layout): void;
36
37 /**
38 * Assemble a caption to describe an item
39 *
40 * @param Item $item The item to render
41 * @param HtmlDocument $caption The container to add the result to
42 * @param string $layout The name of the layout
43 *
44 * @return void
45 */
46 public function assembleCaption($item, HtmlDocument $caption, string $layout): void;
47
48 /**
49 * Assemble a footer with additional information for an item
50 *
51 * @param Item $item The item to render
52 * @param HtmlDocument $footer The container to add the result to
53 * @param string $layout The name of the layout
54 *
55 * @return void
56 */
57 public function assembleFooter($item, HtmlDocument $footer, string $layout): void;
58
59 /**
60 * Assemble a title for an item
61 *
62 * @param Item $item The item to render
63 * @param HtmlDocument $title The container to add the result to
64 * @param string $layout The name of the layout
65 *
66 * @return void
67 */
68 public function assembleTitle($item, HtmlDocument $title, string $layout): void;
69
70 /**
71 * Assemble extended information for an item
72 *
73 * @param Item $item The item to render
74 * @param HtmlDocument $info The container to add the result to
75 * @param string $layout The name of the layout
76 *
77 * @return void
78 */
79 public function assembleExtendedInfo($item, HtmlDocument $info, string $layout): void;
80
81 /**
82 * Assemble a custom section for an item
83 *
84 * @param Item $item The item to render
85 * @param string $name The identifier of the section
86 * @param HtmlDocument $element The container to add the result to
87 * @param string $layout The name of the layout
88 *
89 * @return bool Whether to add the section to the layout
90 */
91 public function assemble($item, string $name, HtmlDocument $element, string $layout): bool;
92 }