Papi_Entry_Type::box PHP Method

box() protected method

Add new meta box with properties.
protected box ( mixed $file_or_options = [], array $properties = [] )
$file_or_options mixed
$properties array
    protected function box($file_or_options = [], $properties = [])
    {
        if (!is_string($file_or_options) && !is_array($file_or_options) && !is_object($file_or_options)) {
            return;
        }
        list($options, $properties) = papi_get_options_and_properties($file_or_options, $properties, true);
        // Check so we have a post the to add the box to.
        // @codeCoverageIgnoreStart
        if (!$this->load_boxes) {
            return;
        }
        // @codeCoverageIgnoreEnd
        if (is_callable($properties)) {
            $properties = call_user_func($properties);
        }
        // Check and convert all non properties objects to properties objects.
        $properties = $this->convert_properties($properties);
        // Create a core box instance and add it to the boxes array.
        array_push($this->boxes, new Papi_Core_Box($options, $properties));
    }