-
Notifications
You must be signed in to change notification settings - Fork 9
/
Text.php
41 lines (35 loc) · 1.3 KB
/
Text.php
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
<?php
namespace Modularity\Module\Text;
class Text extends \Modularity\Module
{
public $slug = 'text';
public $supports = array('editor');
public function init()
{
$this->nameSingular = __('Text', 'modularity');
$this->namePlural = __('Texts', 'modularity');
$this->description = __('Outputs text', 'modularity');
}
public function data() : array
{
$data = get_fields($this->ID);
$data['classes'] = implode(' ', apply_filters('Modularity/Module/Classes', array('box', 'box-panel'), $this->post_type, $this->args));
return $data;
}
public function template()
{
if (!isset($this->data['hide_box_frame']) || !$this->data['hide_box_frame']) {
return 'box.blade.php';
}
return 'article.blade.php';
}
/**
* Available "magic" methods for modules:
* init() What to do on initialization
* data() Use to send data to view (return array)
* style() Enqueue style only when module is used on page
* script Enqueue script only when module is used on page
* adminEnqueue() Enqueue scripts for the module edit/add page in admin
* template() Return the view template (blade) the module should use when displayed
*/
}