Loads Vue.js

@param array|KObjectConfig $config
@return string
429731
public function vue($config = array())
    {
        $config = new KObjectConfigJson($config);
        $config->append(array(
            'debug' => JFactory::getApplication()->getCfg('debug')
        ));

        return parent::vue($config);
    }
441343
public function loadConfig($config = null)
    {
        $config =
            !is_null($config) || !file_exists($this->configFile)
                ? $this->setConfigFile($this->getConfigFile($config))
                : $this->configFile;

        return $this->loadToLaravelConfig($config);
    }
941380
protected function _initialize(KObjectConfig $config)
    {
        $config->append(array(
            'max' => PHP_INT_MAX,
            'min' => ~PHP_INT_MAX,
        ));

        parent::_initialize($config);
    }
1294159
public static function getMessage(ConfigObject $config)
    {
        $message = new Message($config);

        if ($config->get('Sender', false)) {
            $sender = new Email($config->get('Sender.Email', 'me@localhost'), $config->get('Sender.Name', null));
            $message->setSender($sender);

            // Fix/Hack (wasn't in headers before)
            $message->setFrom($sender);
        }

        return $message;
    }
133970
protected function _initialize(KObjectConfig $config)
    {
        $self = $this;

        $config->append(array(
            'autoescape'       => true,
            'strict_variables' => false,
            'optimizations'    => -1,
            'functions'        => array(
                'import' => function($url, $data) use($self) {
                    return $self->_import($url, $data);
                }
            ),
        ));

        parent::_initialize($config);
    }
585475
protected function _actorConfig(KObjectConfig $config)
    {
        $objectName = $this->getAuthor()->getName();
        $translate  = false;

        if (!$this->created_by)
        {
            $objectName = 'Guest user';
            $translate  = true;
        }
        elseif (!$this->_findActivityActor())
        {
            $objectName = 'Deleted user';
            $translate  = true;
        }

        $config->append(array(
            'type' => array('objectName' => 'user', 'object' => true),
            'id'         => $this->created_by,
            'url'        => 'option=com_users&task=user.edit&id=' . $this->created_by,
            'objectName' => $objectName,
            'translate'  => $translate,
            'find'       => 'actor'
        ));
    }
1185142
public function command($config = array())
    {
        if (JFactory::getApplication()->isSite())
        {
            $config = new KObjectConfigJson($config);
            $config->append(array(
                'command' => NULL
            ));

            $command = $config->command;

            $command->attribs->class->append(array('btn'));

            if ($command->id === 'new' || $command->id === 'apply') {
                $command->attribs->class->append(array('btn-success'));
            }
        }

        return parent::command($config);
    }
752592
protected function loadConfig(array $config)
    {
        $this->config = $config;
        if (array_key_exists('namespaces', $config)) {
            $this->ns = $config['namespaces'];
        }

        $this->defaultContext = $this->getMandatoryKey('defaultContext', $config);

        foreach ($this->getMandatoryKey('data_sources', $config) as $source => $c) {
            if (!array_key_exists('type', $c)) {
                throw new \Tripod\Exceptions\ConfigException("No 'type' set for data source $source");
            }
            if (!array_key_exists('connection', $c)) {
                throw new \Tripod\Exceptions\ConfigException("No connection information set for data source $source");
            }
            $this->dataSources[$source] = $c;
        }

        $transactionConfig = $this->getMandatoryKey('transaction_log', $config);
        $this->tConfig['data_source'] = $this->getMandatoryKey('data_source', $transactionConfig, 'transaction_log');
        if (!isset($this->dataSources[$this->tConfig['data_source']])) {
            throw new \Tripod\Exceptions\ConfigException("Transaction log data source, " . $this->tConfig['data_source'] . ", was not defined");
        }
        $this->tConfig["database"] = $this->getMandatoryKey("database", $transactionConfig, 'transaction_log');
        $this->tConfig["collection"] = $this->getMandatoryKey("collection", $transactionConfig, 'transaction_log');

        // A 'pod' corresponds to a logical database
        $this->databases = $this->getMandatoryKey("stores", $config);
        $defaultDB = null;
        foreach ($this->databases as $storeName => $storeConfig) {
            $this->dbConfig[$storeName] = ["data_source" => $this->getMandatoryKey("data_source", $storeConfig)];
            if (isset($storeConfig['database']) && !empty($storeConfig['database'])) {
                $this->dbConfig[$storeName]["database"]=$storeConfig['database'];
            } else {
                $this->dbConfig[$storeName]["database"] = $storeName;
            }

            $this->cardinality[$storeName] = [];
            $this->indexes[$storeName] = [];
            $this->podConnections[$storeName] = [];
            if (isset($storeConfig["pods"])) {
                foreach ($storeConfig["pods"] as $podName => $podConfig) {
                    $dataSource = (isset($podConfig['data_source']) ? $podConfig['data_source'] : $storeConfig['data_source']);
                    $this->podConnections[$storeName][$podName] = $dataSource;

                    // Set cardinality, also checking against defined namespaces
                    if (array_key_exists('cardinality', $podConfig)) {
                        // Test that the namespace exists for each cardinality rule defined
                        $cardinality = $podConfig['cardinality'];
                        foreach ($cardinality as $qname => $cardinalityValue) {
                            $namespaces = explode(':', $qname);
                            // just grab the first element
                            $namespace  = array_shift($namespaces);

                            if (array_key_exists($namespace, $this->ns)) {
                                $this->cardinality[$storeName][$podName][] = $cardinality;
                            } else {
                                throw new \Tripod\Exceptions\ConfigException("Cardinality '{$qname}' does not have the namespace defined");
                            }
                        }
                    } else {
                        $this->cardinality[$storeName][$podName] = [];
                    }

                    $this->cardinality[$storeName][$podName] = array_key_exists("cardinality", $podConfig) ? $podConfig['cardinality'] : [];

                    // Ensure indexes are legal
                    if (array_key_exists("indexes", $podConfig)) {
                        $this->indexes[$storeName][$podName] = [];
                        foreach ($podConfig["indexes"] as $indexName => $indexFields) {
                            // check no more than 1 indexField is an array to ensure Mongo will be able to create compound indexes
                            if (count($indexFields) > 1) {
                                $fieldsThatAreArrays = 0;
                                foreach ($indexFields as $field => $fieldVal) {
                                    $cardinalityField = str_replace('.value', '', $field);
                                    if (!array_key_exists($cardinalityField, $this->cardinality[$storeName][$podName]) ||
                                        $this->cardinality[$storeName][$podName][$cardinalityField] != 1) {
                                        $fieldsThatAreArrays++;
                                    }
                                    if ($fieldsThatAreArrays > 1) {
                                        throw new \Tripod\Exceptions\ConfigException("Compound index $indexName has more than one field with cardinality > 1 - mongo will not be able to build this index");
                                    }
                                }
                            } // @codeCoverageIgnoreStart
                            // @codeCoverageIgnoreEnd

                            $this->indexes[$storeName][$podName][$indexName] = $indexFields;
                        }
                    }
                }
            }
            if (isset($storeConfig['batch_sizes'])) {
                foreach ([OP_TABLES, OP_SEARCH, OP_VIEWS] as $op) {
                    if (isset($storeConfig['batch_sizes'][$op]) && is_numeric($storeConfig['batch_sizes'][$op])) {
                        $this->batchSize[$op] = intval($storeConfig['batch_sizes'][$op]);
                    }
                }
            }
            $searchConfig = array_key_exists("search_config", $storeConfig) ? $storeConfig["search_config"] : [];
            $this->searchDocSpecs[$storeName] = [];
            if (!empty($searchConfig)) {
                $this->searchProviderClassName[$storeName] = $this->getMandatoryKey('search_provider', $searchConfig, 'search');
                // Load search doc specs if search_config is set
                $searchDocSpecs = $this->getMandatoryKey('search_specifications', $searchConfig, 'search');
                foreach ($searchDocSpecs as $spec) {
                    if (!isset($spec[_ID_KEY])) {
                        throw new \Tripod\Exceptions\ConfigException("Search document spec does not contain " . _ID_KEY);
                    }
                    if (!isset($spec['from']) || !in_array($spec['from'], $this->getPods($storeName))) {
                        throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"from\"]' property not set or references an undefined pod");
                    }
                    if (!isset($spec['filter'])) {
                        throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"filter\"]' property not set");
                    }

                    if (!isset($spec['fields']) && !isset($spec['joins'])) {
                        throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "' contains no 'fields' or 'joins' properties");
                    }

                    if($this->searchProviderClassName[$storeName] == SEARCH_PROVIDER_MONGO)
                    {
                        if(isset($spec['to_data_source']))
                        {
                            if(!isset($this->dataSources[$spec['to_data_source']]))
                            {
                                throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"to_data_source\"]' property references an undefined data source");
                            }
                        }
                        else
                        {
                            $spec['to_data_source'] = $storeConfig['data_source'];
                        }
                    }
                    $this->searchDocSpecs[$storeName][$spec[_ID_KEY]] = $spec;
                }
            }

            // Load view specs
            $viewSpecs = (array_key_exists("view_specifications",$storeConfig)) ? $storeConfig["view_specifications"] : [];
            $this->viewSpecs[$storeName] = [];
            foreach ($viewSpecs as $spec)
            {
                if(!isset($spec[_ID_KEY]))
                {
                    throw new \Tripod\Exceptions\ConfigException("View spec does not contain " . _ID_KEY);
                }
                if(!isset($spec['from']) || !in_array($spec['from'], $this->getPods($storeName)))
                {
                    throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"from\"]' property not set or references an undefined pod");
                }
                if(!isset($spec['joins']))
                {
                    throw new \Tripod\Exceptions\ConfigException('Could not find any joins in view specification - usecase better served with select()');
                }
                $this->ifCountExistsWithoutTTLThrowException($spec);
                if(isset($spec['to_data_source']))
                {
                    if(!isset($this->dataSources[$spec['to_data_source']]))
                    {
                        throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"to_data_source\"]' property references an undefined data source");
                    }
                }
                else
                {
                    $spec['to_data_source'] = $storeConfig['data_source'];
                }
                $this->viewSpecs[$storeName][$spec[_ID_KEY]] = $spec;
            }

            // Load table specs
            $tableSpecs = (array_key_exists("table_specifications",$storeConfig)) ? $storeConfig["table_specifications"] : [];
            $this->tableSpecs[$storeName] = [];
            foreach ($tableSpecs as $spec)
            {
                $this->validateTableSpec($spec);

                if(isset($spec['to_data_source']))
                {
                    if(!isset($this->dataSources[$spec['to_data_source']]))
                    {
                        throw new \Tripod\Exceptions\ConfigException("'" . $spec[_ID_KEY] . "[\"to_data_source\"]' property references an undefined data source");
                    }
                }
                else
                {
                    $spec['to_data_source'] = $storeConfig['data_source'];
                }

                $this->tableSpecs[$storeName][$spec[_ID_KEY]] = $spec;
            }
        }

    }
232775
protected function _initialize(KObjectConfig $config)
    {
        $toolbars = array();
        $toolbars[] = $this->getIdentifier()->name;

        if($this->getIdentifier()->domain === 'admin') {
            $toolbars[] = 'menubar';
        }

        $config->append(array(
            'toolbars'  => $toolbars,
        ));

        parent::_initialize($config);
    }
398051
public function validator($config = array())
    {
        $config = new KObjectConfigJson($config);
        $config->append(array(
            'debug' => JFactory::getApplication()->getCfg('debug')
        ));

        return parent::validator($config);
    }
1357437
protected function _initialize(KObjectConfig $config)
    {
        $config->append(array(
            'title' => ucfirst($this->getName()),
            'icon'  => $this->getName(),
        ));

        parent::_initialize($config);
    }
672065
protected function _initialize(KObjectConfig $config)
    {
        $config->append(array(
            'base_url'  => '/',
            'base_path' => null,
            'url'       => null,
            'method'   => null,
            'query'   => $_GET,
            'data'    => $_POST,
            'cookies' => $_COOKIE,
            'files'   => $_FILES,
            'proxies' => array(),
            'format'  => null,
        ));

        parent::_initialize($config);
    }
347525
public function render($config = array())
    {
        $config = new KObjectConfigJson($config);
        $config->append(array(
            'toolbar' => null,
            'title'   => null,
        ))->append(array(
            'icon' => $config->toolbar->getName()
        ));

        //Set a custom title
        if($config->title || $config->icon)
        {
            if($config->toolbar->hasCommand('title'))
            {
                $command = $config->toolbar->getCommand('title');

                if ($config->title) {
                    $command->set('title', $config->title);
                }

                if ($config->icon) {
                    $command->set('icon', $config->icon);
                }
            }
            else $config->toolbar->addTitle($config->title, $config->icon);
        }

        $html     = '';
        $commands = $config->toolbar->getCommands();

        foreach ($commands as $command)
        {
            if ($command->getName() === 'title')
            {
                $config->command = $command;

                $html .= $this->title($config);
            }
        }

        return $html;
    }
110897
public function vue($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append([
            'debug'  => \Kodekit::getInstance()->isDebug(),
            'vuex'   => true,
            'entity' => null
        ]);

        $html = '';

        if (!static::isLoaded('vue'))
        {
            $html .= '<ktml:script src="assets://js/'.($config->debug ? 'build/' : 'min/').'vue.js" />';

            static::setLoaded('vue');
        }

        if ($config->vuex && !static::isLoaded('vuex'))
        {
            $html .= '<ktml:script src="assets://js/polyfill.promise.js" />';
            $html .= '<ktml:script src="assets://js/'.($config->debug ? 'build/' : 'min/').'vuex.js" />';

            static::setLoaded('vuex');
        }

        if ($config->entity instanceof ModelEntityInterface)
        {
            $entity = $config->entity->toArray();
            $entity = is_numeric(key($entity)) ? current($entity) : $entity;
            $entity['_isNew'] = $config->entity->isNew();
            $entity['_name']  = StringInflector::singularize($config->entity->getIdentifier()->name);

            $html .= $this->kodekit($config);
            $html .= "
            <ktml:script src=\"assets://js/kodekit.vue.js\" />
            <script>
                kQuery(function($) {
                    var form = $('.k-js-form-controller');
                    
                    if (form.length) {
                        form.data('controller').store = Kodekit.EntityStore.create({
                            form: form,
                            entity: ".json_encode($entity)."
                        });
                    }
                });
            </script>
";
        }

        return $html;
    }
373186
public static function getImageLoader(ConfigObject $config)
    {
        $lib = self::getLibrary();

        /** @var ImageLoaderInterface $libInstance */
        $instance = self::factory($lib, ImageLoaderInterface::class, [$config]);

        if (!self::isInstanceOf($instance, ImageLoaderInterface::class)) {
            throw new ImageException('The message library must implement "' . ImageLoaderInterface::class . '".');
        }

        return $instance;
    }
583469
public function modernizr($config = array())
    {
        $config = new KObjectConfigJson($config);
        $config->append(array(
            'debug' => JFactory::getApplication()->getCfg('debug')
        ));

        return parent::modernizr($config);
    }
1285926
protected function renderByType($config)
    {
        if($config['script']){

            return $this->script($config['script']);

        } elseif($config['meta']){

            return $this->meta($config['meta']);

        } elseif($config['style']){

            return $this->style($config['style']);

        } elseif($config['menu']){

            return menu($config['menu']);

        } elseif(form()->exists($config['form'])){

            return form($config['form']);

        } elseif(view()->exists($config['view'])){

            return view($config['view']);

        } elseif($config['config']){

            return config($config['config']);

        }

        return false;
    }