Microweber\Providers\Content\ContentManagerCrud::get PHP Метод

get() публичный Метод

It accepts string or array as parameters. You can pass any db field name as parameter to filter content by it. All parameter are passed to the get() function You can get and filter content and also order the results by criteria
public get ( mixed | array | boolean | string $params = false ) : array | boolean | mixed
$params mixed | array | boolean | string You can pass parameters as string or as array
Результат array | boolean | mixed Array of content or false if nothing is found
    public function get($params = false)
    {
        $params2 = array();
        if (is_string($params)) {
            $params = parse_str($params, $params2);
            $params = $params2;
        }
        if (!is_array($params)) {
            $params = array();
            $params['is_active'] = 1;
        }
        $cache_group = 'content/global';
        if (isset($params['cache_group'])) {
            $cache_group = $params['cache_group'];
        }
        $table = $this->tables['content'];
        if (!isset($params['is_deleted'])) {
            $params['is_deleted'] = 0;
        }
        $params['table'] = $table;
        $params['cache_group'] = $cache_group;
        if (isset($params['id'])) {
            $params['id'] = intval($params['id']);
        }
        if (isset($params['search_by_keyword'])) {
            $params['keyword'] = $params['search_by_keyword'];
        }
        if (isset($params['category']) and is_numeric($params['category'])) {
            $params['category'] = intval($params['category']);
            //check if this is dynamic category
            $cat_id = $params['category'];
            $category = $this->app->category_manager->get_by_id($cat_id);
            if (is_array($category) and isset($category['category_subtype']) and $category['category_subtype'] == 'content_filter' and isset($category['category_subtype_settings']) and isset($category['category_subtype_settings']['filter_content_by_keywords']) and trim($category['category_subtype_settings']['filter_content_by_keywords']) != '') {
                $params['keyword'] = $category['category_subtype_settings']['filter_content_by_keywords'];
            }
        }
        if (isset($params['keyword']) and !isset($params['search_in_fields'])) {
            $params['search_in_fields'] = array('title', 'content_body', 'content', 'description', 'content_meta_keywords', 'content_meta_title', 'url');
        }
        if (isset($params['keyword'])) {
            if (!is_admin()) {
                $params['is_deleted'] = 0;
                $params['is_active'] = 1;
            }
        }
        $get = parent::get($params);
        if (isset($params['count']) or isset($params['single']) or isset($params['one']) or isset($params['data-count']) or isset($params['page_count']) or isset($params['data-page-count'])) {
            if (isset($get['url'])) {
                $get['full_url'] = $this->app->url_manager->site($get['url']);
            }
            return $get;
        }
        if (is_array($get)) {
            $data2 = array();
            foreach ($get as $item) {
                if (isset($item['url'])) {
                    $item['url'] = $this->app->url_manager->site($item['url']);
                }
                $data2[] = $item;
            }
            $get = $data2;
            return $get;
        }
    }