code/template/helper/grid.php
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;
    }
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;
    }
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 ; }
Render an enable field

@param   array   $config An optional array with configuration options
@return  string  Html
Render an enable field