本文整理汇总了PHP中Nette\Forms\Container::addCheckbox方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::addCheckbox方法的具体用法?PHP Container::addCheckbox怎么用?PHP Container::addCheckbox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Forms\Container
的用法示例。
在下文中一共展示了Container::addCheckbox方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateForm
public function generateForm(Items\Base $item, Nette\Forms\Container &$formContainer, $name, $parentName, $togglingObject, array $userOptions = [])
{
$input = $formContainer->addCheckbox($name, $name);
$input->setOption('id', $parentName . '__' . $name);
$input->setValue($item->getContent());
if (!is_null($togglingObject)) {
$togglingObject->toggle($input->getOption('id'));
}
$item->applyUserOptions($input, $userOptions);
}
示例2: createImageUpload
protected function createImageUpload(Nette\Forms\Container $container, $image)
{
$id = $this->lookupPath('Nette\\Application\\UI\\Presenter') . '-form';
if ($image !== NULL) {
$container->addCheckbox('deleteImg', 'common.form.removeImage')->addCondition(Form::EQUAL, FALSE)->toggle($id . '-pic-customize');
}
$container->addFileUpload('img', 'common.form.image')->setOption('id', $id . '-pic-image')->addCondition(Form::FILLED)->addRule(Form::IMAGE);
// upload is filled => show img options
$container['img']->addCondition(Form::FILLED)->toggle($id . '-pic-customize');
// has image and deleteImg is checked => show upload
if ($image !== NULL) {
$container['deleteImg']->addCondition(Form::EQUAL, TRUE)->toggle($id . '-pic-image');
}
}
示例3: addCheckers
/**
* @param \Nette\Forms\Container $container
* @throws Exception
* @internal
*/
public function addCheckers(\Nette\Forms\Container $container)
{
$items = $this->grid->getData();
$primaryKey = $this->getPrimaryKey();
foreach ($items as $item) {
try {
$primaryValue = $this->grid->getProperty($item, $primaryKey);
if (!isset($container[$primaryValue])) {
$container->addCheckbox(Helpers::formatColumnName($primaryValue))->controlPrototype->title = $primaryValue;
}
} catch (\Exception $e) {
throw new Exception('You should define some else primary key via $grid->setPrimaryKey() ' . "because currently defined '{$primaryKey}' key is not suitable for operation feature.");
}
}
}
示例4: addCheckers
/**
* @param \Nette\Forms\Container $container
* @internal
*/
public function addCheckers(\Nette\Forms\Container $container)
{
$items = $this->grid->getData();
$primaryKey = $this->getPrimaryKey();
$propertyAccessor = $this->grid->getPropertyAccessor();
foreach ($items as $item) {
$primaryValue = $propertyAccessor->getProperty($item, $primaryKey);
if (!isset($container[$primaryValue])) {
$container->addCheckbox(Helpers::formatColumnName($primaryValue));
}
}
}