1 | <?php |
||
30 | abstract class AbstractDataTablesProvider implements DataTablesProviderInterface { |
||
31 | |||
32 | use ButtonTwigExtensionTrait; |
||
33 | use RouterTrait; |
||
34 | use TranslatorTrait; |
||
35 | |||
36 | /** |
||
37 | * Constructor. |
||
38 | * |
||
39 | * @param RouterInterface $router The router. |
||
40 | * @param TranslatorInterface $translator The translator. |
||
41 | * @param ButtonTwigExtension $buttonTwigExtension The button Twig extension. |
||
42 | */ |
||
43 | public function __construct(RouterInterface $router, TranslatorInterface $translator, ButtonTwigExtension $buttonTwigExtension) { |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | public function getMethod() { |
||
55 | |||
56 | /** |
||
57 | * {@inheritdoc} |
||
58 | */ |
||
59 | public function getOptions() { |
||
69 | |||
70 | /** |
||
71 | * Render the DataTables buttons. |
||
72 | * |
||
73 | * @param mixed $entity The entity. |
||
74 | * @param string $editRoute The edit route. |
||
75 | * @param string $deleteRoute The delete route. |
||
76 | * @param bool $enableDelete Enable delete ? |
||
77 | * @return string Returns the DataTables buttons. |
||
78 | */ |
||
79 | protected function renderButtons($entity, $editRoute, $deleteRoute = null, $enableDelete = true) { |
||
110 | |||
111 | /** |
||
112 | * Render a date. |
||
113 | * |
||
114 | * @param DateTime $date The date. |
||
115 | * @param string $format The format. |
||
116 | * @return string Returns the rendered date. |
||
117 | */ |
||
118 | protected function renderDate(DateTime $date = null, $format = "Y-m-d") { |
||
121 | |||
122 | /** |
||
123 | * Render a date/time. |
||
124 | * |
||
125 | * @param DateTime $date The date/time. |
||
126 | * @param string $format The format. |
||
127 | * @return string Returns the rendered date/time. |
||
128 | */ |
||
129 | protected function renderDateTime(DateTime $date = null, $format = DateTimeRenderer::DATETIME_FORMAT) { |
||
132 | |||
133 | /** |
||
134 | * Render a float. |
||
135 | * |
||
136 | * @param float $number The number. |
||
137 | * @param int $decimals The decimals. |
||
138 | * @param string $decPoint The decimal point. |
||
139 | * @param string $thousandsSep The thousands separator. |
||
140 | * @return string Returns the rendered number. |
||
141 | */ |
||
142 | protected function renderFloat($number, $decimals = 2, $decPoint = ".", $thousandsSep = ",") { |
||
148 | |||
149 | /** |
||
150 | * Wrap a content. |
||
151 | * |
||
152 | * @param string|null $prefix The prefix |
||
153 | * @param string $content The content. |
||
154 | * @param string|null $suffix The suffix. |
||
155 | * @return string Returns the wrapped content. |
||
156 | */ |
||
157 | protected function wrapContent($prefix, $content, $suffix) { |
||
171 | } |
||
172 |