本文整理汇总了PHP中Nette\Forms\Controls\BaseControl::idMask方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseControl::idMask方法的具体用法?PHP BaseControl::idMask怎么用?PHP BaseControl::idMask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Forms\Controls\BaseControl
的用法示例。
在下文中一共展示了BaseControl::idMask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponentForm
/**
* Component factory.
* @see Nette/ComponentContainer#createComponent()
*/
protected function createComponentForm($name)
{
// NOTE: signal-submit on form disregard component's state
// because form is created directly by Presenter in signal handling phase
// and this principle is used to detect submit signal
if (!$this->wasRendered) {
$this->receivedSignal = 'submit';
}
$form = new Nette\Application\UI\Form($this, $name);
$form->setTranslator($this->getTranslator());
Nette\Forms\Controls\BaseControl::$idMask = 'frm-datagrid-' . $this->getUniqueId() . '-%s';
$form->onSuccess[] = array($this, 'formSubmitHandler');
$form->addSubmit('resetSubmit', 'Reset state');
$form->addSubmit('filterSubmit', 'Apply filters');
$form->addSelect('operations', 'Selected:', $this->operations);
$form->addSubmit('operationSubmit', 'Send')->onClick = $this->onOperationSubmit;
// page input
$form->addText('page', 'Page', 1);
$form['page']->setDefaultValue($this->page);
$form->addSubmit('pageSubmit', 'Change page');
// items per page selector
$form->addSelect('items', 'Items per page', array_combine($this->displayedItems, $this->displayedItems));
$form['items']->setDefaultValue($this->itemsPerPage);
$form->addSubmit('itemsSubmit', 'Change');
// generate filters FormControls
if ($this->hasFilters()) {
$defaults = array();
$sub = $form->addContainer('filters');
foreach ($this->getFilters() as $filter) {
$sub->addComponent($filter->getFormControl(), $filter->getName());
// NOTE: must be setted after is FormControl conntected to the form
$defaults[$filter->getName()] = $filter->value;
}
$sub->setDefaults($defaults);
}
// checker
if ($this->hasOperations()) {
$sub = $form->addContainer('checker');
if ($this->isSignalReceiver('submit')) {
// NOTE: important!
$ds = clone $this->dataSource;
$this->filterItems();
}
foreach ($this->getRows() as $row) {
$sub->addCheckbox($row[$this->keyName], $row[$this->keyName]);
}
if (isset($ds)) {
$this->dataSource = $ds;
}
}
$renderer = $form->getRenderer();
$renderer->wrappers['controls']['container'] = NULL;
$renderer->wrappers['label']['container'] = NULL;
$renderer->wrappers['control']['container'] = NULL;
$form->setRenderer($renderer);
return;
}