Render the action bar commands

@param   array   $config An optional array with configuration options
@return  string  Html
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;
    }
785354
public function enable($config = array())
    {
        $translator = $this->getObject('translator');

        $config = new ObjectConfigJson($config);
        $config->append(array(
            'entity'    => null,
            'field'     => 'enabled',
            'clickable' => true
        ))->append(array(
            'enabled'   => (bool) $config->entity->{$config->field},
            'data'      => array($config->field => $config->entity->{$config->field} ? 0 : 1),
        ))->append(array(
            'alt'       => $config->enabled ? $translator->translate('Enabled') : $translator->translate('Disabled'),
            'tooltip'   => $config->enabled ? $translator->translate('Disable Item') : $translator->translate('Enable Item'),
            'color'     => $config->enabled ? '#468847' : '#b94a48',
            'icon'      => $config->enabled ? 'enabled' : 'disabled',
        ));

        $class  = $config->enabled ? 'k-table__item--state-published' : 'k-table__item--state-unpublished';

        $tooltip = '';

        if ($config->clickable)
        {
            $data    = htmlentities(json_encode($config->data->toArray()));
            $tooltip = 'data-k-tooltip=\'{"container":".k-ui-container","delay":{"show":500,"hide":50}}\'
            style="cursor: pointer"
            data-action="edit" 
            data-data="'.$data.'" 
            data-original-title="'.$config->tooltip.'"';
        }

        $html = '<span class="k-table__item--state '.$class.'" '.$tooltip.'>'.$config->alt.'</span>';
        $html .= $this->createHelper('behavior')->tooltip();

        return $html;
    }
16063
public function display($config = array())
    {
        $config = new KObjectConfigJson($config);
        $config->append(array(
            'editor'    => null,
            'name'      => 'description',
            'value'     => '',
            'width'     => '100%',
            'height'    => '500',
            'cols'      => '75',
            'rows'      => '20',
            'buttons'   => true,
            'options'   => array()
        ));

        // Add editor styles and scripts in JDocument to page when rendering
        $this->getIdentifier('com:koowa.view.page.html')->getConfig()->append(['template_filters' => ['document']]);

        $editor  = JFactory::getEditor($config->editor);
        $options = KObjectConfig::unbox($config->options);

        $result = $editor->display($config->name, $config->value, $config->width, $config->height, $config->cols, $config->rows, KObjectConfig::unbox($config->buttons), $config->name, null, null, $options);
        
        // Some editors like CKEditor return inline JS. 
        $result = str_replace('<script', '<script data-inline', $result);

        return $result;
    }
1295221
protected function formatRedirectUrl(array $config)
    {
        $redirect = value($config['redirect']);

        return Str::startsWith($redirect, '/')
                    ? $this->app['url']->to($redirect)
                    : $redirect;
    }
801580
public function renderSidebarMenuItems($config): string
    {
        $config = $this->prepareMenuConfig($config);
        $this->setPageTitle($config);
        $out = '';
        foreach ($config as $mainData) {
            $childrenContainer = '';
            $liclass = $mainData['active'] ? 'active' : '';

            if (!empty($mainData['children'])) {
                $children = '';
                foreach ($mainData['children'] as $child) {
                    $children .= Text::insert($this->_defaultConfig['templates']['item'], [
                        'title' => $child['title'],
                        'icon' => isset($child['icon']) ? Text::insert($this->_defaultConfig['templates']['icon'], ['icon' => $child['icon']]) : '',
                        'href' => isset($child['url']) ? Router::url($child['url']) : '',
                        'childrenArrow' => '',
                        'childrenContainer' => '',
                        'liclass' => $child['active'] ? 'active' : '',
                    ]);
                }
                $childrenContainer = Text::insert($this->_defaultConfig['templates']['childrenContainer'], [
                    'children' => $children,
                ]);
                $liclass .= ' treeview';
            }
            $out .= Text::insert($this->_defaultConfig['templates']['item'], [
                'class' => $mainData['active'] ? 'active' : '',
                'liclass' => $liclass,
                'title' => '<span>' . $mainData['title'] . '</span>',
                'icon' => isset($mainData['icon']) ? Text::insert($this->_defaultConfig['templates']['icon'], ['icon' => $mainData['icon']]) : '',
                'href' => isset($mainData['url']) ? Router::url($mainData['url']) : '',
                'childrenArrow' => !empty($mainData['children']) ? $this->_defaultConfig['templates']['childrenArrow'] : '',
                'childrenContainer' => $childrenContainer,
            ]);
        }

        return $out;
    }
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' ]
		] );
	}
393400
public function flash($config = array())
    {
        $data = $this->_template->getData();

        if (isset($data['flash']) && $data['flash']->message) {
            $message = array_merge((array) $data['flash']->getMessage(true), $config);
            return $this->message($message['message'], $message);
        }
    }
363742
public function actionAll( $config = [] ) {

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

		return $this->render( 'all', [
			'dataProvider' => $dataProvider,
			'visibilityMap' => Gallery::$visibilityMap,
			'statusMap' => Gallery::$statusMap
		]);
	}
243392
public function actionAll( $config = [] ) {

		Url::remember( Yii::$app->request->getUrl(), 'forms' );

		$modelClass = $this->modelService->getModelClass();

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

		return $this->render( 'all', [
			'dataProvider' => $dataProvider,
			'visibilityMap' => $modelClass::$visibilityMap,
			'statusMap' => $modelClass::$statusMap
		]);
	}
51665
public function renderWidget( $config = [] ) {

		// Models and HTML
		$models		= $this->modelPage;
		$modelsHtml	= [];

		// No models to render
		if( count( $models ) <= 0 ) {

			return;
		}

		// Views
		$wrapperView	= $this->template . '/wrapper';
		$singleView		= $this->template . '/single';

		if( Yii::$app->core->multiSite && Yii::$app->core->subDirectory ) {

			$siteName = Yii::$app->core->getSiteName();

			if( isset( $this->basePath ) ) {

				$this->basePath = Url::toRoute( [ "$siteName/$this->basePath" ] );
			}
			else {

				$this->basePath = Url::toRoute( [ "$siteName" ] );
			}
		}

	   if( !empty( $this->basePath ) ) {

			$this->allPath		= Url::toRoute( [ "/$this->basePath/$this->allPath" ], true );
			$this->singlePath	= !empty( $this->singlePath ) ? Url::toRoute( [ "/$this->basePath/$this->singlePath" ], true ) : Url::toRoute( [ "/$this->basePath" ], true );
		}
		else {

			$this->allPath		= Url::toRoute( [ "/$this->allPath" ], true );
			$this->singlePath	= !empty( $this->singlePath ) ? Url::toRoute( [ "/$this->singlePath" ], true ) : null;
		}

		$idxCounter	= 0;

		foreach( $models as $model ) {

			$content = $this->render( $singleView, [ 'index' => $idxCounter, 'model' => $model, 'widget' => $this ] );

			if( $this->wrapSingle ) {

				$modelsHtml[] = Html::tag( $this->singleWrapper, $content, $this->singleOptions );
			}
			else {

				$modelsHtml[] = $this->render( $singleView, [ 'index' => $idxCounter, 'model' => $model, 'widget' => $this ] );
			}

			$idxCounter++;
		}

		$modelsHtml = implode( '', $modelsHtml );

		$content = $this->render( $wrapperView, [ 'modelsHtml' => $modelsHtml, 'widget' => $this, 'modelCount' => $idxCounter ] );

		if( $this->wrap ) {

			return Html::tag( $this->wrapper, $content, $this->options );
		}
		else {

			return $content;
		}
	}
1316120
public function getCommand($name, $config = array())
    {
        if(!isset($this->_commands[$name]))
        {
            //Create the config object
            $command = new KControllerToolbarCommand($name, $config);

            //Attach the command to the toolbar
            $command->setToolbar($this);

            //Find the command function to call
            if (method_exists($this, '_command' . ucfirst($name)))
            {
                $function = '_command' . ucfirst($name);
                $this->$function($command);
            }
            else
            {
                //Don't set an action for GET commands
                if (!isset($command->href))
                {
                    $command->append(array(
                        'attribs' => array(
                            'data-action' => $command->getName()
                        )
                    ));
                }
            }
        }
        else $command = $this->_commands[$name];

        return $command;
    }
1004522
public function renderChooser( $config = [] ) {

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

		return $this->render( $chooserView, [ 'widget' => $this ] );
	}
958536
public function renderDragger( $config = [] ) {

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

		return $this->render( $draggerView, [ 'widget' => $this ] );
	}
72862
public function render(ComActivitiesActivityInterface $activity, $config = array())
    {
        $config = new KObjectConfig($config);

        $translator = $activity->getTranslator();

        $output = $activity->getActivityFormat();

        if (preg_match_all('/{(.*?)}/', $output, $labels))
        {
            $tokens = $translator->getActivityTokens($activity);

            foreach ($labels[1] as $label)
            {
                $parts = explode(':', $label);

                if (isset($tokens[$parts[0]]))
                {
                    $token = $tokens[$parts[0]];

                    $object = clone $token;

                    // Deal with context translations.
                    if (!isset($parts[1]))
                    {
                        if ($object->isTranslatable()) {
                            $object->setDisplayName($translator->translateActivityToken($object, $activity));
                        }
                    }
                    else $object->setDisplayName($parts[1]);

                    if ($object = $this->_renderObject($object, $config)) {
                        $output = str_replace('{' . $label . '}', $object, $output);
                    }
                }
            }
        }

        return $output;
    }
1303006
protected function renderSlide($slideConfig = [])
    {
        $imageOptions = ArrayHelper::getValue($slideConfig, 'image', []);
        $imageSrc = ArrayHelper::remove($imageOptions, 'src', null);
        if (!$imageSrc) {
            return '';
        }

        $caption = $this->renderCaption(ArrayHelper::getValue($slideConfig, 'caption', false));
        $options = ArrayHelper::getValue($slideConfig, 'options', []);
        $options = ArrayHelper::merge($this->slideOptions, $options);

        $html[] = Html::beginTag('li', $options);
        $html[] = Html::img($imageSrc, $imageOptions);
        $html[] = $caption;
        $html[] = Html::endTag('li');
        return implode("\n", $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'
        );
    }
1167363
public function actionAll( $config = [] ) {

		Url::remember( Yii::$app->request->getUrl(), 'fxsliders' );

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

		return $this->render( 'all', [
			'dataProvider' => $dataProvider,
			'statusMap' => Slider::$statusMap
		]);
	}