/** * Constructor. * */ public function __construct($manager, $id, $args = array()) { //let the parent do what it has to parent::__construct($manager, $id, $args); //print the pre add view content add_action('customize_controls_print_footer_scripts', array($this, 'hu_print_pre_add_view_template'), 1); }
/** * Constructor. * */ public function __construct($manager, $id, $args = array()) { //let the parent educate us parent::__construct($manager, $id, $args); $this->contexts = hu_get_contexts_list(); $_default_locations = hu_get_builtin_widget_zones_location(); //generates the locations for json $locations = array(); foreach ($_default_locations as $_id => $data) { $_k = key($data); $locations[$_k] = $data[$_k]; } $this->locations = $locations; //generates the default widget zone for json $default_zones = array(); foreach (hu_get_default_widget_zones() as $_zone_id => $_data) { //get the default location $_loc = isset($_default_locations[$_zone_id]) ? key($_default_locations[$_zone_id]) : ''; $default_zones[] = array('id' => $_data['id'], 'title' => $_data['name'], 'contexts' => array('_all_'), 'locations' => array($_loc), 'is_builtin' => true, 'description' => $_data['description']); } $this->default_zones = $default_zones; //print the pre add view content add_action('customize_controls_print_footer_scripts', array($this, 'hu_print_pre_add_view_template'), 1); //print template for built-in models like primary, secondary, footer-1, etc... add_action('customize_controls_print_footer_scripts', array($this, 'hu_print_built_in_templates'), 1); }