/**
  * Method to test duplicate().
  *
  * @param string $label
  * @param string $icon
  * @param string $id
  * @param string $prefix
  * @param string $task
  *
  * @covers       \Windwalker\Bootstrap\Dropdown::duplicate
  * @dataProvider duplicateProvider
  */
 public function testDuplicate($label, $icon, $id, $prefix, $task)
 {
     // Clean dropDownList property
     $this->refDropDownList->setValue(array());
     Dropdown::duplicate($id, $prefix);
     $this->assertEquals(array('<li>' . '<a href = "javascript://" onclick="listItemTask(\'cb' . $id . '\', \'' . $task . '\')">' . ($icon ? '<span class="icon-' . $icon . '"></span> ' : '') . $label . '</a>' . '</li>'), $this->refDropDownList->getValue());
 }
Пример #2
0
 */
use Windwalker\Bootstrap\Dropdown;
// No direct access
defined('_JEXEC') or die;
/**
 * Prepare data for this template.
 *
 * @var $data Windwalker\Data\Data
 * @var $grid Windwalker\View\Helper\GridHelper
 * @var $item Windwalker\Data\Data
 */
$grid = $data->grid;
$item = $grid->current;
// Duplicate
Dropdown::duplicate($grid->row, '{{controller.list.name.lower}}.batch');
Dropdown::divider();
// Published & Unpublished
if ($item->state) {
    Dropdown::unpublish($grid->row, '{{controller.list.name.lower}}.state');
} else {
    Dropdown::publish($grid->row, '{{controller.list.name.lower}}.state');
}
// Trash & Delete
if (JDEBUG || $data->state->get('filter.{{controller.item.name.lower}}.state') == -2) {
    Dropdown::addCustomItem(\JText::_('JTOOLBAR_DELETE'), 'delete', $grid->row, '{{controller.list.name.lower}}.state.delete');
} else {
    Dropdown::trash($grid->row, '{{controller.list.name.lower}}.state');
}
// Render it
echo Dropdown::render();