本文整理汇总了PHP中Nette\Application\UI\Form::attached方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::attached方法的具体用法?PHP Form::attached怎么用?PHP Form::attached使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\Application\UI\Form
的用法示例。
在下文中一共展示了Form::attached方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attached
protected function attached($presenter)
{
parent::attached($presenter);
if ($presenter instanceof Nette\Application\IPresenter) {
$this->onAttached($this);
}
}
示例2: attached
/**
* @param \Nette\ComponentModel\Container $obj
*/
protected function attached($obj)
{
if ($obj instanceof \Nette\Application\IPresenter) {
$this->attachHandlers();
}
parent::attached($obj);
}
示例3: attached
/**
* This method will be called when the component (or component's parent)
* becomes attached to a monitored object. Do not call this method yourself.
* @param Nette\Application\IComponent
* @return void
*/
protected function attached($presenter)
{
parent::attached($presenter);
if ($this->getContext()->hasService('translator')) {
$this->setTranslator($this->getContext()->translator);
}
}
示例4: attached
protected function attached($presenter)
{
parent::attached($presenter);
if ($presenter instanceof \Nette\Application\UI\Presenter) {
$this->builder->setDefaults($this);
}
}
示例5: attached
protected function attached($control)
{
parent::attached($control);
if (!is_array($this->onSuccess)) {
$this->onSuccess = [];
}
array_unshift($this->onSuccess, function () {
$this->flashMessage($this->formatFlashMessage('success'), 'success');
});
$this->onSuccess[] = function () {
if (!$this->getPresenter()->isAjax()) {
$this->getControl()->redirect('this');
}
};
if (!is_array($this->onError)) {
$this->onError = [];
}
array_unshift($this->onError, function () {
$this->flashMessage($this->formatFlashMessage('error'), 'danger');
});
if (!is_array($this->onSubmit)) {
$this->onSubmit = [];
}
array_unshift($this->onSubmit, function () {
$this->getControl()->redrawControl();
});
}
示例6: attached
/**
* @param \Nette\ComponentModel\Container $parent
*/
protected function attached($parent)
{
parent::attached($parent);
if ($parent instanceof Control) {
$this->setRenderer(new \FoundationFormRenderer\Renderer());
}
}
示例7: attached
/**
* @param \Nette\ComponentModel\IComponent $component
*/
protected function attached($component)
{
parent::attached($component);
if (!$component instanceof Presenter) {
return;
}
$this->configure($component);
}
示例8: attached
/**
* @param Nette\Application\IPresenter
*/
protected function attached($presenter)
{
parent::attached($presenter);
if ($presenter instanceof Nette\Application\IPresenter) {
$this->beforeSetup();
$this->setup();
}
}
示例9: attached
/**
* Autofocus AJAX handling.
*
* @param $presenter
*/
public function attached($presenter)
{
parent::attached($presenter);
if ($this->autofocus !== NULL) {
$this[$this->autofocus]->setAttribute('autofocus');
if ($presenter->isAjax()) {
$presenter->payload->focus = $this[$this->autofocus]->getHtmlId();
}
}
}
示例10: attached
public function attached($presenter)
{
parent::attached($presenter);
/** @var App\GameModule\DTO\Unit $unit */
foreach ($this->units as $unit) {
$this->addText($unit->getId() . 'number', $unit->getName())->setAttribute('class', 'text')->addCondition(Nette\Forms\Form::NUMERIC);
}
$this->addSubmit('submit', 'Train')->setAttribute('type', 'image')->setAttribute('class', 'dynamic_img')->setAttribute('id', 'btn_train');
return $this;
}
示例11: attached
protected function attached($parent)
{
parent::attached($parent);
if (!$parent instanceof UI\Presenter || !Debugger::isEnabled()) {
return;
}
Debugger::$bar->addPanel($this);
$this->addText('destination', 'Destination')->addRule($this::FILLED, 'Je třeba zadat destinaci.')->getControlPrototype()->placeholder = 'Please enter destination';
$this->addSubmit('redirect', 'Redirect')->onClick[] = callback($this, 'processRedirect');
$this->addSubmit('showLink', 'Show link')->onClick[] = callback($this, 'processShowLink');
}
示例12: attached
/**
* This method will be called when the component (or component's parent)
* becomes attached to a monitored object. Do not call this method yourself.
* @param Nette\ComponentModel\IComponent
* @return void
*/
protected function attached($presenter)
{
parent::attached($presenter);
if (empty($this->uploadDir)) {
$this->cache = new Nette\Caching\Cache($this->presenter->context->getService('cacheStorage'), 'nette-plupload');
$this->uploadDir = $this->presenter->context->expand('%tempDir%') . '/nette-plupload-files';
if (!is_dir($this->uploadDir) && !mkdir($this->uploadDir, 0775, TRUE)) {
throw new \RuntimeException(sprintf('Cannot create upload dir %s', $this->uploadDir));
}
}
}
示例13: attached
/**
* @param $presenter
*/
public function attached($presenter)
{
parent::attached($presenter);
$renderer = new BootstrapRenderer();
$this->setRenderer($renderer);
if ($presenter instanceof Presenter) {
$this->setTranslator($presenter->getTranslator());
if ($presenter->isAjax()) {
$this->getElementPrototype()->class[] = 'ajax';
}
}
}
示例14: attached
/**
* @param \Nette\ComponentModel\Container
*/
protected function attached($obj)
{
if ($obj instanceof Nette\Application\IPresenter) {
if ($this->getComponents()->count() === 0) {
# form was created by operator new
$this->beforeSetup();
$this->setup();
$this->afterSetup();
}
$this->attachHandlers();
}
parent::attached($obj);
}
示例15: attached
/**
* @param \Nette\ComponentModel\Container $obj
*/
protected function attached($obj)
{
parent::attached($obj);
if ($this->mapper) {
$this->mapper->assign($this->data, $this);
}
$this->onAttached($this);
if ($obj instanceof \Nette\Application\UI\Presenter) {
if (!$this->isSubmitted()) {
if ($this->mapper) {
$this->mapper->load();
}
$this->onLoad($this);
}
}
}