forked from gambitph/Titan-Framework
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclass-option-multicheck-pages.php
54 lines (43 loc) · 1.38 KB
/
class-option-multicheck-pages.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
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class TitanFrameworkOptionMulticheckPages extends TitanFrameworkOptionMulticheck {
public $defaultSecondarySettings = array(
'options' => array(),
);
private static $allPages;
/*
* Display for options and meta
*/
public function display() {
// Remember the pages so as not to perform any more lookups
if ( ! isset( self::$allPages ) ) {
self::$allPages = get_pages();
}
$this->settings['options'] = array();
foreach ( self::$allPages as $page ) {
$this->settings['options'][$page->ID] = $page->post_title;
}
parent::display();
}
/*
* Display for theme customizer
*/
public function registerCustomizerControl( $wp_customize, $section, $priority = 1 ) {
// Remember the pages so as not to perform any more lookups
if ( ! isset( self::$allPages ) ) {
self::$allPages = get_pages();
}
$this->settings['options'] = array();
foreach ( self::$allPages as $page ) {
$this->settings['options'][$page->ID] = $page->post_title;
}
$wp_customize->add_control( new TitanFrameworkOptionMulticheckControl( $wp_customize, $this->getID(), array(
'label' => $this->settings['name'],
'section' => $section->settings['id'],
'settings' => $this->getID(),
'description' => $this->settings['desc'],
'options' => $this->settings['options'],
'priority' => $priority,
) ) );
}
}