Instantiate a new Element

@param string $config_file File name in config/navigation/ or a Config_Group instance
@throws Kohana_Exception
@return Element
@since 2.0
978592
public static function factory($config_file = 'bootstrap')
	{
		if(is_a($config_file, 'Config_Group')) {
			$config_file->set('cfg_name', $config_file->group_name());
			$element_config = $config_file->as_array();
		}
		else {
			// Load element config
			$element_config = self::_get_element_config($config_file);
			$element_config['cfg_name'] = $config_file;
		}


		return new Element($element_config);
	}
599336
public static function config($config, $file = false) {
        $app = self::$app;
        if (isset ($app->configs [ $config ]) && !$file) {
            $confObj = $app->configs [ $config ];
        } else {
            $confObj = $file ? ConfigurationLoader::loadFromFile($config) : $app->configLoader->loadConfig($config);
            if (!$confObj) {
                $confObj = new Configuration ($config);
            }
            $app->configs [ $config ] = $confObj;
        }

        return $confObj;
    }
414659
public function create( $model, $config = [] ) {

		if( empty( $model->label ) ) {

			$model->label = $model->name;
		}

		if( !isset( $model->valueType ) ) {

			$model->valueType = Meta::VALUE_TYPE_TEXT;
		}

		return parent::create( $model );
	}
1308761
protected function instantiateNode()
    {
        return new FloatNode($this->name, $this->parent, $this->min, $this->max);
    }
378436
public function instantiate($identifier, $config = array())
    {
        //Get the filter(s) we need to create
        $filters = (array) $identifier;

        //Create the filter chain
        $filter = array_shift($filters);
        $filter = $this->_createFilter($filter, $config);

        foreach ($filters as $name) {
            $filter->addFilter(self::_createFilter($name, $config));
        }

        return $filter;
    }
670709
public function create( $model, $config = [] ) {

		$modelClass	= static::$modelClass;

		$group	= isset( $config[ 'group' ] ) ? $config[ 'group' ] : null;
		$role	= isset( $config[ 'role' ] ) ? $config[ 'role' ] : null;
		$user	= isset( $config[ 'user' ] ) ? $config[ 'user' ] : null;

		$model->groupId	= isset( $group ) ? $group->id : $model->groupId;
		$model->roleId	= isset( $role ) ? $role->id : $model->roleId;
		$model->userId	= isset( $user ) ? $user->id : $model->userId;

		$model->status	= isset( $model->status ) ? $model->status : $modelClass::STATUS_NEW;

		if( empty( $model->roleId ) ) {

			$role = $this->roleService->getBySlugType( CmnGlobal::ROLE_GROUP_MEMBER, CmnGlobal::TYPE_COMMUNITY );

			$model->roleId = $role->id;
		}

		return parent::create( $model, $config );
	}
545956
private function get_config( $config_name ) {
		// Check that we have our config_name defined in our config
		if ( isset( $this->config[ $config_name ] ) !== true ) {
			throw new \Exception(
				'No "' . $config_name . '" config set. I don\'t know what to load!'
			);
		}
		else {
			// If its set, just hand it over
			return $this->config[ $config_name ];
		}
	}
1010529
public function create( $model, $config = [] ) {

		$avatar = isset( $config[ 'avatar' ] ) ? $config[ 'avatar' ] : null;
		$banner = isset( $config[ 'banner' ] ) ? $config[ 'banner' ] : null;

		$this->fileService->saveFiles( $model, [ 'avatarId' => $avatar, 'bannerId' => $banner ] );

		return parent::create( $model, $config );
	}
1266340
public static function newInstance($name = null)
    {
        $currentClass = get_called_class();
        $bean         = Bean::config(is_null($name) ? Bean::name($currentClass) : $name);
        $class        = $bean['class'];
        $properties   = $bean['properties'] ?? [];
        if ($class != $currentClass) {
            throw new \Mix\Exception\ConfigException("Bean class is not equal to the current class, Current class: {$currentClass}, Bean class: {$class}");
        }
        return new $class($properties);
    }
421025
protected static function create()
    {
        $config = new static();

        $config->config = (new ConfigFactory())->create($config->getProjectPath(), $config->CONFIG_FILE);

        return $config;
    }
258592
public static function forge($config = array(), $filename = null)
	{
		!is_array($config) and $config = array();

		$config = array_merge(\Config::get('image', array()), $config);

		$protocol = ucfirst( ! empty($config['driver']) ? $config['driver'] : 'gd');
		$class = 'Image_'.$protocol;
		if ($protocol == 'Driver' || ! class_exists($class))
		{
			throw new \FuelException('Driver '.$protocol.' is not a valid driver for image manipulation.');
		}
		$return = new $class($config);
		if ($filename !== null)
		{
			$return->load($filename);
		}
		return $return;
	}
1050200
public function init($config = [])
    {
        $type  = isset($config['type']) ? $config['type'] : 'File';
        $class = false !== strpos($type, '\\') ? $type : '\\think\\log\\driver\\' . ucwords($type);

        $this->config = $config;

        unset($config['type']);

        if (class_exists($class)) {
            $this->driver = new $class($config);
        } else {
            throw new Exception('class not exists:' . $class, $class);
        }

        return $this;
    }
411522
public function load()
    {
        $file = new File($this->filePath);
        $fileExt = $file->getExtension();
        $fileConfClass = $this->getConfigFileClass($fileExt);
        if (class_exists($fileConfClass)) {
            $fileConf = new $fileConfClass($file);

            return $fileConf;
        }

        throw new ConfNotSupportedException($this->filePath);
    }
889913
public function create() {
        $data = Values::of(array());

        $payload = $this->version->create(
            'POST',
            $this->uri,
            array(),
            $data
        );

        return new ConfigurationInstance($this->version, $payload);
    }
1143657
public function create( $model, $config = [] ) {

		if( empty( $model->value ) ) {

			$model->value = $model->name;
		}

		return parent::create( $model, $config );
	}
37118
public function newInstance(array $config)
    {
        $new_config = array_merge($this->default_config, $config);

        return new static($this->config_handler, $this->url, $new_config);
    }
1199176
public function create()
    {
        $type = NodeType::getByHandle('file');
        if (!is_object($type)) {
            NodeType::add('file');
        }
        $type = NodeType::getByHandle('file_folder');
        if (!is_object($type)) {
            NodeType::add('file_folder');
        }
        $type = NodeType::getByHandle('search_preset');
        if (!is_object($type)) {
            NodeType::add('search_preset');
        }
        $type = TreeType::getByHandle('file_manager');
        if (!is_object($type)) {
            TreeType::add('file_manager');
        }

        $manager = FileManager::get();
        if (!is_object($manager)) {
            $manager = FileManager::add();
        }

        return $manager;
    }