本文整理汇总了PHP中Nette\Application\UI\Form::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::__construct方法的具体用法?PHP Form::__construct怎么用?PHP Form::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($parent, $name, $action = '')
{
parent::__construct($parent, $name);
$this->getElementPrototype()->class = 'login-form';
$this->addProtection('STFU!');
if ($action == '') {
$request = $this->getHttpRequest();
$value = $request->getCookie('login');
$this->addText('login', 'Uživatelské jméno: ')->addRule(Form::FILLED, 'Prosím zadajte přihlašovací jméno.');
$this['login']->getControlPrototype()->class = "input";
if ($value) {
$this->setValues(array('login' => $value));
}
}
$this->addPassword('password', 'Heslo:')->addRule(Form::FILLED, 'Prosím zadajte heslo.');
$this['password']->getControlPrototype()->addAttributes(array('class' => "input"));
$this->addCheckbox('remember', 'Zapamatovat')->setValue(true);
if ($action == '') {
$this->addSubmit('send', 'Přihlásit');
$this->onSuccess[] = array($this, 'formSubmited');
} else {
$this->addSubmit('send', 'Změnit');
$this->onSuccess[] = array($this, 'editFormSubmited');
}
$this['send']->getControlPrototype()->addAttributes(array('class' => "submit"));
}
示例2: __construct
public function __construct()
{
parent::__construct();
$renderer = $this->getRenderer();
$renderer->wrappers['controls']['container'] = '';
$renderer->wrappers['pair']['container'] = 'div class="form-group"';
$renderer->wrappers['label']['container'] = '';
$renderer->wrappers['control']['container'] = 'div class="col-sm-11"';
$renderer->wrappers['control']['.submit'] = "btn btn-default";
$renderer->wrappers['control']['.text'] = "form-control";
$renderer->wrappers['control']['.select'] = "form-control";
$renderer->wrappers['control']['.password'] = "form-control";
$renderer->wrappers['control']['.email'] = "form-control";
$renderer->wrappers['error'] = array('container' => 'div class=errors', 'item' => NULL);
$form = $this->getForm();
$form->getElementPrototype()->class('form-horizontal');
foreach ($form->getControls() as $control) {
if ($control instanceof Controls\Button) {
$control->setAttribute('class', empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
$usedPrimary = TRUE;
} elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
$control->setAttribute('class', 'form-control');
} elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
$control->getSeparatorPrototype()->setName('div')->class($control->getControlPrototype()->type);
}
}
}
示例3: __construct
public function __construct(\Nette\Security\User $user)
{
parent::__construct();
$this->user = $user;
$this->createFields();
$this->addEventListeners();
}
示例4: __construct
/**
* @param \Nette\ComponentModel\IContainer $parent
* @param string $name
* @param \Nette\Localization\ITranslator $translator
*/
public function __construct(IContainer $parent = NULL, $name = NULL, ITranslator $translator)
{
parent::__construct($parent, $name);
$this->mode = FormMode::CREATE_MODE;
$this->setTranslator($translator);
$renderer = $this->getRenderer();
$renderer->wrappers['controls']['container'] = NULL;
$renderer->wrappers['pair']['container'] = 'div class=form-group';
$renderer->wrappers['control']['container'] = 'div class=col-sm-9';
$renderer->wrappers['label']['container'] = 'div class="col-sm-3 control-label"';
$renderer->wrappers['control']['description'] = 'span class=help-block';
$renderer->wrappers['control']['errorcontainer'] = 'span class=help-block';
$renderer->wrappers['control']['erroritem'] = 'span class="label label-danger"';
$renderer->wrappers['pair']['.error'] = 'has-error';
$renderer->wrappers['control']['.submit'] = 'btn btn-lg btn-primary';
$renderer->wrappers['control']['.button'] = 'btn btn-lg btn-default';
//$renderer->wrappers['control']['.text'] = 'form-control';
// dd($renderer);
// dd($renderer->wrappers['controls']);
// dd($renderer->wrappers['control']);
// make form and controls compatible with Twitter Bootstrap
$this->getElementPrototype()->class('form-horizontal');
foreach ($this->getControls() as $control) {
if ($control instanceof Controls\Button) {
$control->getControlPrototype()->addClass(empty($usedPrimary) ? 'btn btn-primary' : 'btn btn-default');
$usedPrimary = TRUE;
} elseif ($control instanceof Controls\TextBase || $control instanceof Controls\SelectBox || $control instanceof Controls\MultiSelectBox) {
$control->getControlPrototype()->addClass('form-control');
} elseif ($control instanceof Controls\Checkbox || $control instanceof Controls\CheckboxList || $control instanceof Controls\RadioList) {
$control->getSeparatorPrototype()->setName('div')->addClass($control->getControlPrototype()->type);
}
}
}
示例5: __construct
public function __construct(CategoryService $categoryService, Category $editedCategory = null)
{
parent::__construct();
$this->categoryService = $categoryService;
$this->editedCategory = $editedCategory;
$this->createFields();
}
示例6: __construct
/**
* FormBootstrap constructor.
*
* @param null|ITranslator $translator
* @param null|string $type null, inline, vertical
*/
public function __construct($translator, $type = null)
{
if ($translator) {
$this->setTranslator($translator);
}
parent::__construct();
}
示例7: __construct
public function __construct()
{
parent::__construct();
$this->addText('login', 'Login:')->setRequired();
$this->addPassword('password', 'Heslo:')->setRequired();
$this->addSubmit('submit', 'Přihlásit se')->getControlPrototype()->class('btn btn-primary btn-block');
}
示例8: __construct
public function __construct(CategoryService $categoryService, Product $editedProduct = null)
{
parent::__construct();
$this->categoryService = $categoryService;
$this->editedProduct = $editedProduct;
$this->createFields();
}
示例9: __construct
public function __construct()
{
parent::__construct();
$this->addText('title', 'Názov')->addRule(self::MAX_LENGTH, '"%label" môže mať maximálnu dĺžku %value.', 255)->setRequired('Prosím, vyplňte povinné pole %label.');
$this->addTextArea('content', 'Obsah');
$this->addSubmit('save', 'Uložiť');
}
示例10: __construct
public function __construct(\Nette\ComponentModel\IContainer $parent, $name)
{
parent::__construct($parent, $name);
$field = new \Netxten\Forms\Controls\HiddenFieldWithLabel('Search:');
$field->setHtmlId('search');
$this->addComponent($field, 'search');
$this->addSubmit('submit', 'Search');
}
示例11: __construct
public function __construct(Nette\ComponentModel\IContainer $parent = NULL, $name = NULL)
{
parent::__construct();
$this->monitor('Nette\\Application\\UI\\Presenter');
if ($parent !== NULL) {
$parent->addComponent($this, $name);
}
}
示例12: __construct
/**
* @param string $permanentLoginExpiration
*/
public function __construct(CurrentCartService $currentCartService, \Nette\Security\User $user, $permanentLoginExpiration)
{
parent::__construct();
$this->currentCartService = $currentCartService;
$this->user = $user;
$this->createFields();
$this->addEventListeners($permanentLoginExpiration);
}
示例13: __construct
public function __construct(ShipmentService $shipmentService, ShipmentHelper $shipmentHelper, Shipment $shipment = null, User $user = null)
{
parent::__construct();
$this->shipmentService = $shipmentService;
$this->shipmentHelper = $shipmentHelper;
$this->shipment = $shipment;
$this->user = $user;
$this->createFields();
}
示例14: __construct
public function __construct()
{
parent::__construct();
$this->addHidden('articleId');
$this->addText('nick', 'Přezdívka')->addRule(Form::MAX_LENGTH, 'Maximálně 30 znaků', 30)->setRequired('Přezdívka je povinná');
$this->addTextArea('content', 'Obsah')->setRequired('Obsah je povinný');
$this->addSubmit('send', 'Potvrdit');
$this->onSuccess[] = [$this, 'success'];
return $this;
}
示例15: __construct
public function __construct()
{
parent::__construct();
$renderer = $this->getRenderer();
$renderer->wrappers['controls']['container'] = '';
$renderer->wrappers['pair']['container'] = '';
$renderer->wrappers['label']['container'] = '';
$renderer->wrappers['control']['container'] = '';
$renderer->wrappers['control']['.submit'] = 'btn';
}