private function initialize_dashboard() { if (defined("ART_VIEW")) { $viewpath = join("/", [ART_VIEW, Dashboard::VIEWPATH]); } else { $viewpath = Dashboard::VIEWPATH; } add_action("wp_dashboard_setup", function () use($viewpath) { CustomPost\Haml::initialize(Dashboard::VIEWPATH); foreach (glob($viewpath . "/*{.php,.haml}", GLOB_BRACE) as $filename) { $template_name = basename($filename); $template_name = explode(".", $template_name)[0]; $label = isset($this->options["dashboard_widgets"][$template_name]) ? $this->options["dashboard_widgets"][$template_name] : $template_name; $widget = new Dashboard($template_name, $label); $widget->register(); } }); }
function render($post, $args) { extract($this->options); CustomPost\Haml::render_box($template, [], $this->nonce_key(), $this->nonce_name()); }