Commit 9a98aa95 by Alexander Kochetov

Removed Sortable::begin() ... Sortable::end() usage.

parent c6076cb3
...@@ -20,36 +20,23 @@ use yii\helpers\Html; ...@@ -20,36 +20,23 @@ use yii\helpers\Html;
* echo Sortable::widget(array( * echo Sortable::widget(array(
* 'items' => array( * 'items' => array(
* 'Item 1', * 'Item 1',
* 'Item 2', * array(
* 'Item 3', * 'content' => 'Item2',
* 'options' => array(
* 'tag' => 'li',
* ),
* ),
* ), * ),
* 'clientOptions' => array(
* 'cursor' => 'move',
* ),
* ));
* ```
*
* The following example will show the content enclosed between the [[begin()]]
* and [[end()]] calls within the sortable widget:
*
* ```php
* Sortable::begin(array(
* 'options' => array( * 'options' => array(
* 'tag' => 'div', * 'tag' => 'ul',
* ), * ),
* 'itemOptions' => array( * 'itemOptions' => array(
* 'tag' => 'div', * 'tag' => 'li',
* ), * ),
* 'clientOptions' => array( * 'clientOptions' => array(
* 'cursor' => 'move', * 'cursor' => 'move',
* ), * ),
* )); * ));
*
* echo 'Item 1';
* echo 'Item 2';
* echo 'Item 3';
*
* Sortable::end();
* ``` * ```
* *
* @see http://api.jqueryui.com/sortable/ * @see http://api.jqueryui.com/sortable/
...@@ -59,35 +46,24 @@ use yii\helpers\Html; ...@@ -59,35 +46,24 @@ use yii\helpers\Html;
class Sortable extends Widget class Sortable extends Widget
{ {
/** /**
* @var array. * @var array list of sortable containers.
* @todo comments
*/ */
public $items = array(); public $items = array();
/** /**
* @var array. * @var array list of individual sortable container default options.
* @todo comments
*/ */
public $itemOptions = array(); public $itemOptions = array();
/** /**
* Initializes the widget. * Renders the widget.
*/ */
public function init() public function run()
{ {
parent::init();
$options = $this->options; $options = $this->options;
$tag = ArrayHelper::remove($options, 'tag', 'ul'); $tag = ArrayHelper::remove($options, 'tag', 'ul');
echo Html::beginTag($tag, $options) . "\n"; echo Html::beginTag($tag, $options) . "\n";
}
/**
* Renders the widget.
*/
public function run()
{
echo $this->renderItems() . "\n"; echo $this->renderItems() . "\n";
$tag = ArrayHelper::getValue($this->options, 'tag', 'ul');
echo Html::endTag($tag) . "\n"; echo Html::endTag($tag) . "\n";
$this->registerWidget('sortable', false); $this->registerWidget('sortable', false);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment