Microweber\Providers\Content\ContentManagerHelpers::get_edit_field_draft PHP Method

get_edit_field_draft() public method

public get_edit_field_draft ( $data )
    public function get_edit_field_draft($data)
    {
        $page = false;
        if (isset($_SERVER['HTTP_REFERER'])) {
            $url = $_SERVER['HTTP_REFERER'];
            $url = explode('?', $url);
            $url = $url[0];
            if (trim($url) == '' or trim($url) == $this->app->url_manager->site()) {
                $page = $this->app->content_manager->homepage();
            } else {
                $page = $this->get_by_url($url);
            }
        } else {
            $url = $this->app->url_manager->string();
        }
        $this->app->content_manager->define_constants($page);
        $table_drafts = $this->tables['content_fields_drafts'];
        $data = parse_params($data);
        if (isset($data['id']) and $data['id'] == 'latest_content_edit') {
            if (isset($page['id'])) {
                $page_data = $this->get_by_id($page['id']);
                $results = array();
                if (isset($page_data['title'])) {
                    $arr = array('rel_type' => 'content', 'field' => 'title', 'value' => $page_data['title']);
                    $results[] = $arr;
                    if (isset($page_data['content_type'])) {
                        $arr = array('rel_type' => $page_data['content_type'], 'field' => 'title', 'value' => $page_data['title']);
                        $results[] = $arr;
                    }
                    if (isset($page_data['subtype'])) {
                        $arr = array('rel_type' => $page_data['subtype'], 'field' => 'title', 'value' => $page_data['title']);
                        $results[] = $arr;
                    }
                }
                if (isset($page_data['content']) and $page_data['content'] != '') {
                    $arr = array('rel_type' => 'content', 'field' => 'content', 'value' => $page_data['content']);
                    $results[] = $arr;
                    if (isset($page_data['content_type'])) {
                        $arr = array('rel_type' => $page_data['content_type'], 'field' => 'content', 'value' => $page_data['content']);
                        $results[] = $arr;
                    }
                    if (isset($page_data['subtype'])) {
                        $arr = array('rel_type' => $page_data['subtype'], 'field' => 'content', 'value' => $page_data['content']);
                        $results[] = $arr;
                    }
                }
                //$results[]
            }
        } else {
            $data['is_draft'] = 1;
            $data['full'] = 1;
            $data['all'] = 1;
            $results = $this->get_edit_field($data);
        }
        $ret = array();
        if ($results == false) {
            return;
        }
        $i = 0;
        foreach ($results as $item) {
            if (isset($item['value'])) {
                $field_content = htmlspecialchars_decode($item['value']);
                $field_content = $this->_decode_entities($field_content);
                $item['value'] = $this->app->parser->process($field_content, $options = false);
            }
            $ret[$i] = $item;
            ++$i;
        }
        return $ret;
    }