Render the action bar commands

@param   array   $config An optional array with configuration options
@return  string  Html
349364
public function render($config = array())
    {
        $config = new KObjectConfigJson($config);
        $config->append(array(
            'toolbar' => null,
        ));

        //Render the buttons
        $html = '';

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

        if (count($commands))
        {
            $html .= '<div class="k-toolbar k-js-toolbar">';

            foreach ($commands as $command)
            {
                $name = $command->getName();

                if ($name === 'title') {
                    continue;
                }

                if(method_exists($this, $name)) {
                    $html .= $this->$name(array('command' => $command));
                } else {
                    $html .= $this->command(array('command' => $command));
                }
            }

            $html .= '</div>';
        }



        return $html;
    }
806881
public function editActivity(string $config)
    {
        $file = (array) JL::open(FEnv::get("framework.config").'smarty_config/smarty.json');
        foreach ($file as $one => $val) {
            if ($one == $config) {
                return ((new Renderer())->jsonRenderer(array("code" => 200, "results" => $val)));
            }
        }

        return ((new Renderer())->jsonRenderer(array("code" => 200, "results" => array())));
    }
1229553
public function build(array $config)
    {
        $output = [];

        // Fix path in output dir
        if ('/' !== substr($config['output_dir'], -1) && strlen($config['output_dir']) > 0) {
            $config['output_dir'] .= '/';
        }

        $output['fontawesome_css'] = $this->buildCssWithoutLess($config);

        /*if ('none' !== $config['less_filter']) {
            $output['fontawesome_css'] = $this->buildCssWithLess($config);
        } else {
            $output['fontawesome_css'] = $this->buildCssWithoutLess($config);
        }*/

        return $output;
    }
1080352
public function actionAll( $config = [] ) {

		$dataProvider = $this->modelService->getPageByType( $this->type );

		return $this->render( 'all', [
			'dataProvider' => $dataProvider,
			'type' => $this->type
		]);
	}
716209
public function renderWidget( $config = [] ) {

		$editorConfig = Yii::$app->core->getEditor();

		$editorClass	= is_string( $editorConfig ) ? $editorConfig : $editorConfig[ 'class' ];
		$editorConfig	= is_array( $editorConfig ) && isset( $editorConfig[ 'options' ] ) ? $editorConfig[ 'options' ] : [];

		$widgetConfig = [ 'loadAssets' => $this->loadAssets, 'selector' => $this->selector, 'config' => $this->config ];

		// Override common config by instance config
		$widgetConfig = ArrayHelper::merge( $editorConfig, $widgetConfig );

		$editorClass::widget( $widgetConfig );
	}
1100609
public static function show($config = array()) {
        ob_start();
        ob_implicit_flush(false);
        try {
            $instance = new static;
            $instance->set($config);
            $out = $instance->run();
        } catch (\Exception $e) {
            // close the output buffer opened above if it has not been closed already
            if (ob_get_level() > 0) {
                ob_end_clean();
            }
            throw $e;
        }
        return ob_get_clean() . $out;
    }
193632
public function dialog($config = array())
    {
        $html  = $this->createHelper('behavior')->modal();
        $html .= $this->command($config);

        return $html;
    }
459829
protected function buildJs(array $config)
    {
        $path = !in_array($config['css_preprocessor'], array('sass', 'scssphp')) ? "/js" : "/javascripts/bootstrap";

        return array(
            'inputs'  => array(
                $config['assets_dir'].$path.'/transition.js',
                $config['assets_dir'].$path.'/alert.js',
                $config['assets_dir'].$path.'/button.js',
                $config['assets_dir'].$path.'/carousel.js',
                $config['assets_dir'].$path.'/collapse.js',
                $config['assets_dir'].$path.'/dropdown.js',
                $config['assets_dir'].$path.'/modal.js',
                $config['assets_dir'].$path.'/tooltip.js',
                $config['assets_dir'].$path.'/popover.js',
                $config['assets_dir'].$path.'/scrollspy.js',
                $config['assets_dir'].$path.'/tab.js',
                $config['assets_dir'].$path.'/affix.js',
                __DIR__.'/../Resources/js/bc-bootstrap-collection.js'
            ),
            'output'        => $config['output_dir'].'js/bootstrap.js'
        );
    }
436810
public function styles($config = array())
    {
        $identifier = $this->getTemplate()->getIdentifier();

        $config = new KObjectConfigJson($config);
        $config->append(array(
            'debug' => JFactory::getApplication()->getCfg('debug'),
            'package' => $identifier->package,
            'domain'  => $identifier->domain
        ))->append(array(
            'folder' => 'com_'.$config->package,
            'file'   => ($identifier->type === 'mod' ? 'module' : $config->domain) ?: 'admin',
            'media_path' => (defined('JOOMLATOOLS_PLATFORM') ? JPATH_WEB : JPATH_ROOT) . '/media'
        ));

        $html = '';

        $path = sprintf('%s/%s/css/%s.css', $config->media_path, $config->folder, $config->file);

        if (!file_exists($path))
        {
            if ($config->file === 'module') {
                $config->css_file = false;
            } else {
                $config->folder = 'koowa';
            }
        }

        if ($this->getTemplate()->decorator() == 'joomla')
        {
            $app      = JFactory::getApplication();
            $template = $app->getTemplate();

            // Load Bootstrap file if it's explicitly asked for
            if ($app->isSite() && file_exists(JPATH_THEMES.'/'.$template.'/enable-koowa-bootstrap.txt')) {
                $html .= $this->getTemplate()->helper('behavior.bootstrap', ['javascript' => false, 'css' => true]);
            }

            // Load overrides for the current admin template
            if ($app->isAdmin() && $config->file === 'admin')
            {
                if (file_exists((defined('JOOMLATOOLS_PLATFORM') ? JPATH_WEB : JPATH_ROOT) . '/media/koowa/com_koowa/css/'.$template.'.css')) {
                    $html .= '<ktml:style src="assets://koowa/css/'.$template.'.css" />';
                }
            }
        }

        $html .= parent::styles($config);

        return $html;
    }
563283
protected function appendCommandsToConfig(array &$config)
    {
        collect($this->entityCommandHandlers)
            ->merge(collect($this->instanceCommandHandlers))
            ->each(function($handler, $commandName) use(&$config) {
                $formFields = $handler->form();
                $formLayout = $formFields ? $handler->formLayout() : null;
                $hasFormInitialData = $formFields
                    ? is_method_implemented_in_concrete_class($handler, 'initialData')
                    : false;

                $config["commands"][$handler->type()][$handler->groupIndex()][] = [
                    "key" => $commandName,
                    "label" => $handler->label(),
                    "description" => $handler->description(),
                    "type" => $handler->type(),
                    "confirmation" => $handler->confirmationText() ?: null,
                    "form" => $formFields ? [
                        "fields" => $formFields,
                        "layout" => $formLayout
                    ] : null,
                    "fetch_initial_data" => $hasFormInitialData,
                    "authorization" => $handler->getGlobalAuthorization()
                ];
            });
    }
817736
public function renderForm( $config = [], $html = [] ) {

		$formView = CodeGenUtil::isAbsolutePath( $this->formView, true ) ? $this->formView : "$this->template/$this->formView";

		return $this->render( $formView, [
			'widget' => $this,
			'infoHtml' => $html[ 'infoHtml' ],
			'fieldsHtml' => $html[ 'fieldsHtml' ]
		] );
	}
271184
public function addCommand($command, $config = array())
    {
        if (!($command instanceof ControllerToolbarCommand)) {
            $command = $this->getCommand($command, $config);
        }

        $this->__commands[$command->getName()] = $command;
        return $command;
    }
496503
public function actionAll( $config = [] ) {

		// Remember return url for crud
		Url::remember( Yii::$app->request->getUrl(), 'files' );

		$dataProvider = $this->modelService->getSharedPage();

		return $this->render( 'all', [
			'dataProvider' => $dataProvider,
			'visibilityMap' => File::$visibilityMap,
			'typeMap' => File::$typeMap
		]);
	}
644000
protected function buildCss(array $config)
    {
        $output = array();
        $output['bootstrap_css'] = array(
            'inputs' => array(
                $this->normalizePath(implode(DIRECTORY_SEPARATOR, array(
                    $config['bootswatch']['path'],
                    $config['bootswatch']['theme'],
                    'bootstrap.css'
                )))
            ),
            'filters' => array('cssrewrite'),
        );
        if ($config['font_awesome']) {
            $output['font_awesome_css'] = array(
                'inputs' => array(
                    $this->normalizePath(implode(DIRECTORY_SEPARATOR, array(
                        $config['bootswatch']['path'],
                        'bower_components/font-awesome/css/font-awesome.css'
                    )))
                ),
                'filters' => array('cssrewrite'),
            );
        }
        return $output;
    }
1348508
public function render($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'toolbar' => null,
            'title'   => null,
        ));

        //Set a custom title
        if($config->title) {
            $config->toolbar->setTitle($config->title);
        }

        $title = $this->getObject('translator')->translate($config->toolbar->getTitle());
        $html  = '';

        if (!empty($title))
        {
            $mobile = ($config->mobile === '' || $config->mobile) ? 'k-title-bar--mobile' : '';

            $html .= '
            <div class="k-title-bar k-js-title-bar '.$mobile.'">
                <div class="k-title-bar__heading">' . $title . '</div>
            </div>';
        }

        return $html;
    }
651227
public function command($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'id'      => '',
            'href'    => '',
            'icon'    => '',
            'allowed' => true,
            'disabled'=> false,
            'data'    => array(),
            'attribs' => array(
                'href'  => '#',
                'class' => array('toolbar')
            )
        ));

        $translator = $this->getObject('translator');

        if ($config->allowed === false)
        {
            $config->attribs->title = $translator->translate('You are not allowed to perform this action');
            $config->attribs->class->append(array('k-is-disabled', 'k-is-unauthorized'));
        }

        //Create the id
        $config->attribs['id'] = 'command-'.$config->id;

        $config->attribs->class->append(array('k-button', 'k-button--default', 'k-button-'.$config->id));

        if ($config->id === 'new' || $config->id === 'save') {
            $config->attribs->class->append(array('k-button--success'));
        }

        //Add the data attributes
        foreach($config->data as $key => $value) {
            $config->attribs['data-'.$key] = (string) $value;
        }

        //Create the href
        if(!empty($config->href)) {
            $config->attribs['href'] = $config->href;
        }

        $attribs = clone $config->attribs;
        $attribs->class = implode(" ", ObjectConfig::unbox($attribs->class));

        $html = '<a '.$this->buildAttributes($attribs).'>';

        $html .= '<span class="'.$config->icon.'" aria-hidden="true"></span> ';
        $html .= '<span class="k-button__text">';
        $html .= $translator->translate($config->label);
        $html .= '</span>';
        $html .= '</a>';

        return $html;
    }
986595
public function api($config = array())
    {
        $config = array_merge_recursive($config, array(
            'key' => get_config_value('locations.api_key'),
            'service' => $this->_service,
            'libraries' => array()
        ));

        return $this->_render('api_'.$config['service'], $config);
    }