Papi_Entry_Type::get_boxes PHP Method

get_boxes() public method

Get boxes from the page type.
public get_boxes ( ) : array
return array
    public function get_boxes()
    {
        if (empty($this->boxes) && $this->load_boxes === false) {
            if (!method_exists($this, 'register')) {
                return [];
            }
            $this->load_boxes = true;
            $this->call_parent_register();
            $this->register();
        }
        // Merge boxes, e.g a parent box with a child box.
        $this->boxes = $this->merge_boxes($this->boxes);
        /**
         * Modify boxes array.
         *
         * @param array  $boxes
         * @param string $id
         */
        $this->boxes = apply_filters('papi/get_boxes', $this->boxes, $this->get_id());
        $this->boxes = is_array($this->boxes) ? $this->boxes : [];
        // Go through all boxes and only add boxes
        // that is a array and remove boxes that isn't
        // a instance of core box class.
        foreach ($this->boxes as $index => $box) {
            if (is_array($box)) {
                if (is_string($index)) {
                    $box['title'] = $index;
                }
                $this->box($box);
                unset($this->boxes[$index]);
                continue;
            }
            // Remove boxes that isn't a instanceof core box class.
            if ($box instanceof Papi_Core_Box === false) {
                unset($this->boxes[$index]);
                continue;
            }
            // Remove box if site id isn't zero and isn't the current blog id.
            if ($box->site_id !== 0 && $box->site_id !== get_current_blog_id()) {
                unset($this->boxes[$index]);
                continue;
            }
        }
        return papi_sort_order(array_reverse($this->boxes));
    }