1 | <?php |
||
25 | class DataTablesTwigExtension extends AbstractDataTablesTwigExtension { |
||
26 | |||
27 | /** |
||
28 | * Service name. |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | const SERVICE_NAME = "webeweb.bundle.datatablesbundle.twig.extension.datatables"; |
||
33 | |||
34 | /** |
||
35 | * Directory. |
||
36 | * |
||
37 | * @var string |
||
38 | */ |
||
39 | const JS_TEMPLATE = "<script type=\"text/javascript\"> |
||
40 | \t$('__selector__').DataTable({ |
||
41 | \t\tajax: { |
||
42 | \t\t\ttype: '__method__', |
||
43 | \t\t\turl: '__url__' |
||
44 | \t\t}, |
||
45 | \t\tcolumns: __columns__, |
||
46 | \t\torder: __order__, |
||
47 | \t\tprocessing: __processing__, |
||
48 | \t\tserverSide: __serverSide__ |
||
49 | \t}); |
||
50 | </script>"; |
||
51 | |||
52 | /** |
||
53 | * Constructor. |
||
54 | */ |
||
55 | public function __construct() { |
||
58 | |||
59 | /** |
||
60 | * Displays a DataTables HTML. |
||
61 | * |
||
62 | * @param DataTablesWrapper $dtWrapper The wrapper. |
||
63 | * @param array $args The arguments. |
||
64 | * @return string Returns the DataTables HTML. |
||
65 | */ |
||
66 | public function dataTablesHTMLFunction(DataTablesWrapper $dtWrapper, array $args = []) { |
||
69 | |||
70 | /** |
||
71 | * Diplays a DataTables JS. |
||
72 | * |
||
73 | * @param DataTablesWrapper $dtWrapper The wrapper. |
||
74 | * @param array $args The arguments. |
||
75 | * @return string Returns the DataTables JS. |
||
76 | */ |
||
77 | public function dataTablesJSFunction(DataTablesWrapper $dtWrapper, array $args = []) { |
||
91 | |||
92 | /** |
||
93 | * Get the Twig functions. |
||
94 | * |
||
95 | * @return array Returns the Twig functions. |
||
96 | */ |
||
97 | public function getFunctions() { |
||
103 | |||
104 | } |
||
105 |