Skip to content

Commit d821906

Browse files
committed
Added label and prompt option
1 parent 636b778 commit d821906

1 file changed

Lines changed: 24 additions & 4 deletions

File tree

src/Datagrid.php

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,9 @@
1414
use Nette\Forms\Container;
1515
use Nette\Forms\Controls\Button;
1616
use Nette\Forms\Controls\Checkbox;
17+
use Nette\Localization\ITranslator;
1718
use Nette\Utils\Html;
1819
use Nette\Utils\Paginator;
19-
use Nette\Localization\ITranslator;
20-
2120

2221
class Datagrid extends UI\Control
2322
{
@@ -102,6 +101,11 @@ class Datagrid extends UI\Control
102101
/** @var string */
103102
protected $filterFormHttpMethod = 'post';
104103

104+
/** @var string */
105+
protected $globalActionSelectPrompt = '- select action -';
106+
107+
/** @var string */
108+
protected $globalActionProcessLabel = 'Do';
105109

106110
/**
107111
* Adds column
@@ -282,6 +286,22 @@ public function translate($s, $count = null)
282286
: $translator->translate((string) $s, $count);
283287
}
284288

289+
/**
290+
* @param string $globalActionSelectPrompt
291+
*/
292+
public function setGlobalActionSelectPrompt($globalActionSelectPrompt)
293+
{
294+
$this->globalActionSelectPrompt = $globalActionSelectPrompt;
295+
}
296+
297+
/**
298+
* @param string $globalActionProcessLabel
299+
*/
300+
public function setGlobalActionProcessLabel($globalActionProcessLabel)
301+
{
302+
$this->globalActionProcessLabel = $globalActionProcessLabel;
303+
}
304+
285305

286306
/*******************************************************************************/
287307

@@ -488,9 +508,9 @@ public function createComponentForm()
488508
$actions = array_map(function($row) { return $row[0]; }, $this->globalActions);
489509
$form['actions'] = new Container();
490510
$form['actions']->addSelect('action', 'Action', $actions)
491-
->setPrompt('- select action -');
511+
->setPrompt($this->globalActionSelectPrompt);
492512
$form['actions']->addCheckboxList('items', '', []);
493-
$form['actions']->addSubmit('process', 'Do');
513+
$form['actions']->addSubmit('process', $this->globalActionProcessLabel);
494514
}
495515

496516
if ($this->translator) {

0 commit comments

Comments
 (0)