1 | <?php |
||
21 | class ContentReviewCMSExtension extends LeftAndMainExtension |
||
22 | { |
||
23 | private static $allowed_actions = [ |
||
24 | 'ReviewContentForm', |
||
25 | 'savereview', |
||
26 | ]; |
||
27 | |||
28 | /** |
||
29 | * URL handler for the "content due for review" form |
||
30 | * |
||
31 | * @param HTTPRequest $request |
||
32 | * @return Form|null |
||
33 | */ |
||
34 | public function ReviewContentForm(HTTPRequest $request) |
||
40 | |||
41 | /** |
||
42 | * Return a handler for "content due for review" forms, according to the given object ID |
||
43 | * |
||
44 | * @param int $id |
||
45 | * @return Form|null |
||
46 | */ |
||
47 | public function getReviewContentForm($id) |
||
67 | |||
68 | /** |
||
69 | * Action handler for processing the submitted content review |
||
70 | * |
||
71 | * @param array $data |
||
72 | * @param Form $form |
||
73 | * @return DBHTMLText|HTTPResponse|null |
||
74 | */ |
||
75 | public function savereview($data, Form $form) |
||
92 | |||
93 | /** |
||
94 | * Return a handler or reviewing content |
||
95 | * |
||
96 | * @return ReviewContentHandler |
||
97 | */ |
||
98 | protected function getReviewContentHandler() |
||
102 | |||
103 | /** |
||
104 | * Find the page this form is updating |
||
105 | * |
||
106 | * @param array $data Form data |
||
107 | * @return SiteTree Record |
||
108 | * @throws HTTPResponse_Exception |
||
109 | */ |
||
110 | protected function findRecord($data) |
||
125 | |||
126 | /** |
||
127 | * Check if the current request has a X-Formschema-Request header set. |
||
128 | * Used by conditional logic that responds to validation results |
||
129 | * |
||
130 | * @todo Remove duplication. See https://github.com/silverstripe/silverstripe-admin/issues/240 |
||
131 | * |
||
132 | * @return bool |
||
133 | */ |
||
134 | protected function getSchemaRequested() |
||
139 | |||
140 | /** |
||
141 | * Generate schema for the given form based on the X-Formschema-Request header value |
||
142 | * |
||
143 | * @todo Remove duplication. See https://github.com/silverstripe/silverstripe-admin/issues/240 |
||
144 | * |
||
145 | * @param string $schemaID ID for this schema. Required. |
||
146 | * @param Form $form Required for 'state' or 'schema' response |
||
147 | * @param ValidationResult $errors Required for 'error' response |
||
148 | * @param array $extraData Any extra data to be merged with the schema response |
||
149 | * @return HTTPResponse |
||
150 | */ |
||
151 | protected function getSchemaResponse($schemaID, $form = null, ValidationResult $errors = null, $extraData = []) |
||
167 | } |
||
168 |