src/View/Helper/HtmlHelper.php
public function toggle(Entity $entity, array $url = [], array $data = [])
    {
        if (count($url) === 0) {
            $url = [
                'action'     => 'toggle',
                'prefix'     => $this->request->getParam('prefix'),
                'plugin'     => $this->request->getParam('plugin'),
                'controller' => $this->request->getParam('controller'),
                (int) $entity->get('id'),
                (int) $entity->get('status')
            ];
        }

        $data = Hash::merge([
            'url'    => $url,
            'entity' => $entity,
        ], $data);

        return $this->_View->element('Core.' .  __FUNCTION__, $data);
    }
public function toggle(Entity $entity, array $url = [], array $data = [])
    {
        if (count($url) === 0) {
            $url = [
                'action'     => 'toggle',
                'prefix'     => $this->request->getParam('prefix'),
                'plugin'     => $this->request->getParam('plugin'),
                'controller' => $this->request->getParam('controller'),
                (int) $entity->get('id'),
                (int) $entity->get('status')
            ];
        }

        $data = Hash::merge([
            'url'    => $url,
            'entity' => $entity,
        ], $data);

        return $this->_View->element('Core.' .  __FUNCTION__, $data);
    }
public function toggle ( Entity $ entity , array $ url = [ ] , array $ data = [ ] ) { if ( count ( $ url ) === 0 ) { $ url = [ 'action' => 'toggle' , 'prefix' => $ this -> request -> getParam ( 'prefix' ) , 'plugin' => $ this -> request -> getParam ( 'plugin' ) , 'controller' => $ this -> request -> getParam ( 'controller' ) , ( int ) $ entity -> get ( 'id' ) , ( int ) $ entity -> get ( 'status' ) ] ; } $ data = Hash :: merge ( [ 'url' => $ url , 'entity' => $ entity , ] , $ data ) ; return $ this -> _View -> element ( 'Core.' . __FUNCTION__ , $ data ) ; }
Create and render ajax toggle element.

@param   Entity $entity
@param   array $url
@param   array $data
@return  string
Create and render ajax toggle element .