public function editButton(EntityInterface $entity, array $options = []): string
    {
        $options = Hash::merge([
            'url' => null,
            'title' => __d('ck_tools', 'edit'),
            'icon' => 'fa fa-pencil',
            'escape' => false,
            'class' => 'btn btn-default btn-xs btn-edit',
        ], $options);

        $url = $options['url'];
        $title = $options['title'];
        $icon = $options['icon'];
        unset($options['url'], $options['title'], $options['icon']);
        if (!$url) {
            // phpcs:ignore
            list($plugin, $controller) = pluginSplit($entity->source());
            $url = [
                'plugin' => $this->_View->request->plugin,
                'controller' => $controller,
                'action' => 'edit',
                $entity->id,
            ];
            $url = $this->augmentUrlByBackParam($url);
        }
        if ($icon) {
            $title = '<i class="' . $icon . '"></i> ' . '<span class="button-text">' . $title . '</span>';
            $options['escape'] = false;
        }

        return $this->Html->link($title, $url, $options);
    }
public function editButton(EntityInterface $entity, array $options = []): string
    {
        $options = Hash::merge([
            'url' => null,
            'title' => __d('ck_tools', 'edit'),
            'icon' => 'fa fa-pencil',
            'escape' => false,
            'class' => 'btn btn-default btn-xs btn-edit',
        ], $options);

        $url = $options['url'];
        $title = $options['title'];
        $icon = $options['icon'];
        unset($options['url'], $options['title'], $options['icon']);
        if (!$url) {
            // phpcs:ignore
            list($plugin, $controller) = pluginSplit($entity->source());
            $url = [
                'plugin' => $this->_View->request->plugin,
                'controller' => $controller,
                'action' => 'edit',
                $entity->id,
            ];
            $url = $this->augmentUrlByBackParam($url);
        }
        if ($icon) {
            $title = '<i class="' . $icon . '"></i> ' . '<span class="button-text">' . $title . '</span>';
            $options['escape'] = false;
        }

        return $this->Html->link($title, $url, $options);
    }
public function editButton ( EntityInterface $ entity , array $ options = [ ] ) : string { $ options = Hash :: merge ( [ 'url' => null , 'title' => __d ( 'ck_tools' , 'edit' ) , 'icon' => 'fa fa-pencil' , 'escape' => false , 'class' => 'btn btn-default btn-xs btn-edit' , ] , $ options ) ; $ url = $ options [ 'url' ] ; $ title = $ options [ 'title' ] ; $ icon = $ options [ 'icon' ] ; unset ( $ options [ 'url' ] , $ options [ 'title' ] , $ options [ 'icon' ] ) ; if ( ! $ url ) { // phpcs:ignore list ( $ plugin , $ controller ) = pluginSplit ( $ entity -> source ( ) ) ; $ url = [ 'plugin' => $ this -> _View -> request -> plugin , 'controller' => $ controller , 'action' => 'edit' , $ entity -> id , ] ; $ url = $ this -> augmentUrlByBackParam ( $ url ) ; } if ( $ icon ) { $ title = '<i class="' . $ icon . '"></i> ' . '<span class="button-text">' . $ title . '</span>' ; $ options [ 'escape' ] = false ; } return $ this -> Html -> link ( $ title , $ url , $ options ) ; }
Renders an edit button

@param \Cake\Datasource\EntityInterface $entity  Entity to take the ID from
@param array                            $options Config options
@return string
Renders an edit button