-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAcfConfigExample.txt
More file actions
42 lines (39 loc) · 1.13 KB
/
Copy pathAcfConfigExample.txt
File metadata and controls
42 lines (39 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/**
* AcfConfigCustom
*
* Create a file in your AdminCustomFiles folder and start the filename with
* ‘AcfConfig’ then ‘a custom name’ and add ‘.php’.
*
* In this file create a class with the basename of the file without the
* extension. This class should extend AcfConfig and implements Module.
*
* Properties of the subclass
*
* @var AdminCustomFiles $adminCustomFiles Instance of AdminCustomFiles may you need it.
* @var Page|NullPage $editPage In processPageEdit it would be the page you are editting.
* @var Template $editTemplate Template from the page above.
*/
class AcfConfigCustom extends AcfConfig implements Module {
/**
* Optional ready method
*
* - Use it or leave out.
* - We call ready() before calling jsConfig().
*/
public function ready() {}
/**
* Required jsConfig method
*
* Return a PHP array ready to be used for $config->js
*
* @return array
*/
public function jsConfig() {
$process = $this->wire('process');
return array(
"activeProcess" => $process->className(),
"editPage" => $this->editPage->id,
"editTemplate" => $this->editTemplate->name,
);
}
}