Find and returns the objects with given type.

@param string $type
@param array $config
@return ObjectData[]
420215
public static function findByType( $type, $config = [] ) {

		$ignoreSite	= isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false;

		if( static::isMultiSite() && !$ignoreSite ) {

			$siteId	= isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId;

			return static::find()->where( 'type=:type AND siteId=:siteId', [ ':type' => $type, ':siteId' => $siteId ] )->orderBy( [ 'order' => SORT_ASC ] )->all();
		}
		else {

			return static::find()->where( 'type=:type', [ ':type' => $type ] )->orderBy( [ 'order' => SORT_ASC ] )->all();
		}
	}
130344
final protected function getConfigs($config = null)
    {
        if (null !== $config) {
            if (array_key_exists($config, self::$_configs)) {
                return self::$_configs[$config];
            } else {
                return false;
            }
        }

        return self::$_configs;
    }
1056492
public function getConfig($type)
    {
        if (null !== $this->cachedConfig) {
            return $this->cachedConfig[$type];
        }

        $this->loadConfig();

        return $this->cachedConfig[$type];
    }
462634
public static function getInject($type = null) {
        if ($type === null)
            return static::$inject;
        elseif (isset(static::$inject[$type]))
            return static::$inject[$type];

        return array();
    }
1326291
protected static function prepareTypes($config)
    {
        $list = isset($config['storage']) ? $config['storage'] : [];
        $list = is_array($list) ? $list : [$list];
        if (count($list) == 0) {
            $list[] = StaticValues::class;
        }
        foreach ($list as $i => $storageClass) {
            $list[$storageClass] = IndexHelper::storageClassToType($storageClass);
            unset($list[$i]);
        }
        return $list;
    }
613258
public static function findByParentType( $parentType, $config = [] ) {

		$ignoreSite	= isset( $config[ 'ignoreSite' ] ) ? $config[ 'ignoreSite' ] : false;

		if( static::isMultiSite() && !$ignoreSite ) {

			$siteId	= isset( $config[ 'siteId' ] ) ? $config[ 'siteId' ] : Yii::$app->core->siteId;

			return static::find()->where( 'parentType=:ptype AND siteId=:siteId', [ ':ptype' => $parentType, ':siteId' => $siteId ] )->all();
		}
		else {

			return static::find()->where( 'parentType=:ptype', [ ':ptype' => $parentType ] )->all();
		}
	}
816044
protected function getOptionsFromConfig(Config $config)
    {
        $options = $this->options;
        foreach (static::$mappingOptions as $option => $ossOption) {
            if (! $config->has($option)) {
                continue;
            }
            $options[$ossOption] = $config->get($option);
        }

        return $options;
    }
401729
protected function getRequestConfig(array $config) : array
    {
        if (!empty($this->defaultRequestOptions)) {
            $config = array_replace_recursive($this->defaultRequestOptions, $config);
        }

        return $config;
    }
114725
public function initialize(array $config)
    {
        $this->belongsTo('ContentTypes', [
            'className' => 'Content.ContentTypes',
            'propertyName' => 'content_type',
            'fields' => ['slug', 'name', 'description'],
            'conditions' => ['Contents.content_type_slug = ContentTypes.slug']
        ]);

        $this->belongsTo('TranslationOf', [
            'className' => 'Content\Model\Table\ContentsTable',
            'foreignKey' => 'translation_for',
            'propertyName' => 'translation_of',
            'fields' => ['slug', 'title', 'description'],
        ]);

        $this->belongsToMany('Roles', [
            'className' => 'User.Roles',
            'propertyName' => 'roles',
            'through' => 'Content.ContentsRoles',
        ]);

        $this->hasMany('ContentRevisions', [
            'className' => 'Content.ContentRevisions',
            'dependent' => true,
        ]);

        $this->hasMany('Translations', [
            'className' => 'Content\Model\Table\ContentsTable',
            'foreignKey' => 'translation_for',
            'dependent' => true,
        ]);

        $this->addBehavior('Timestamp');
        $this->addBehavior('Comment.Commentable');
        $this->addBehavior('Sluggable');
        $this->addBehavior('User.WhoDidIt', [
            'idCallable' => function () {
                return user()->get('id');
            }
        ]);
        $this->addBehavior('Field.Fieldable', [
            'bundle' => function ($entity) {
                if ($entity->has('content_type_slug')) {
                    return $entity->content_type_slug;
                }

                if ($entity->has('id')) {
                    return $this
                        ->get($entity->id, [
                            'fields' => ['id', 'content_type_slug'],
                            'fieldable' => false,
                        ])
                        ->content_type_slug;
                }

                return '';
            }
        ]);

        $this->addBehavior('Search.Searchable', [
            'fields' => function ($content) {
                $words = '';
                if ($content->has('title')) {
                    $words .= " {$content->title}";
                }

                if ($content->has('description')) {
                    $words .= " {$content->description}";
                }

                if (!$content->has('_fields')) {
                    return $words;
                }

                foreach ($content->_fields as $virtualField) {
                    $words .= " {$virtualField}";
                }

                return $words;
            }
        ]);

        $this->addSearchOperator('promote', 'operatorPromote');
        $this->addSearchOperator('author', 'operatorAuthor');
        $this->addSearchOperator('limit', 'Search.Limit');
        $this->addSearchOperator('modified', 'Search.Date', ['field' => 'modified']);
        $this->addSearchOperator('created', 'Search.Date', ['field' => 'created']);
        $this->addSearchOperator('type', 'Search.Generic', ['field' => 'content_type_slug', 'conjunction' => 'auto']);
        $this->addSearchOperator('term', 'operatorTerm');
        $this->addSearchOperator('language', 'Search.Generic', ['field' => 'language', 'conjunction' => 'auto']);
        $this->addSearchOperator('order', 'Search.Order', ['fields' => ['slug', 'title', 'description', 'sticky', 'created', 'modified']]);
    }
1014651
public function merge(array $config, $type)
    {
        foreach ($config as $key => $val) {
            $this->set($key, $val, $type);
        }
    }
404961
public static function queryByType( $parentId, $parentType, $type, $config = [] ) {

		$query = static::queryByParent( $parentId, $parentType, $config );

		$query->andWhere( 'type=:type', [ ':type' => $type ] );

		return $query;
	}
1009040
public function getComponentsByType($type)
    {
        $components = new ArrayList();
        foreach ($this->components as $component) {
            if ($component instanceof $type) {
                $components->push($component);
            }
        }
        return $components;
    }
1049792
protected static function _getList($type) {
        $types = array();

        foreach (self::$_types as $ext => $mimeType) {
            if (is_array($mimeType)) {
                $mimeType = $mimeType[0];
            }

            if (strpos($mimeType, $type) === 0) {
                $types[$ext] = $mimeType;
            }
        }

        return $types;
    }
289291
private function cloneArticleConfig(array $config, $type)
    {
        $result = [];
        foreach ($config as $item) {
            $result[] = ['path' => $item['path'], 'type' => $type];
        }

        return $result;
    }
989202
public function getQueryData(array $config = []) : array
    {
        if (empty($config)) {
            return [];
        }

        $resultSet = [];

        if (!empty($config['info']['finder'])) {
            $table = $config['info']['model'];

            $finder = $config['info']['finder']['name'];
            $options = Hash::get($config, 'info.finder.options', []);

            $resultSet = TableRegistry::get($table)->find($finder, $options);
        }

        if (empty($config['info']['finder']) && !empty($config['info']['query'])) {
            $resultSet = ConnectionManager::get('default')
                ->execute($config['info']['query'])
                ->fetchAll('assoc');
        }

        $columns = explode(',', $config['info']['columns']);

        $result = [];
        foreach ($resultSet as $item) {
            $row = [];
            foreach ($item as $column => $value) {
                if (in_array($column, $columns)) {
                    $row[$column] = $value;
                }
            }
            array_push($result, $row);
        }

        return $result;
    }
433178
private function buildWidgetConfig(string $type, array $config): array
    {
        $type            = substr($type, 3);
        $configKey       = 'form.layouts.' . $type . '.widgets';
        $bootstrapConfig = $this->environment->getConfig();
        $widgetConfig    = ArrayUtil::merge($this->widgetConfig, $bootstrapConfig->get('form.widgets'));

        if ($bootstrapConfig->has($configKey)) {
            $widgetConfig = ArrayUtil::merge($widgetConfig, $bootstrapConfig->get($configKey));
        }

        foreach (StringUtil::deserialize($config['widgets'], true) as $widget) {
            if ($widget['widget'] === '') {
                continue;
            }

            foreach ($this->sections as $section) {
                if ($widget[$section]) {
                    $widgetConfig[$widget['widget']]['templates'][$section] = $widget[$section];
                }
            }
        }

        return $widgetConfig;
    }
966032
protected function parseConfig(string $config): array
    {
        $config = json_decode($config, true);
        if ($config === null) {
            throw new ConfigFileFormatException("Config files should be written in valid JSON");
        }
        return $config;
    }