Comments (7)
Well, this should be imo reported into the Nette issue tracker. I can't see why totally standard call should be "BC breaked".
$me->addMacro('label', array($me, 'macroLabel'), array($me, 'macroLabelEnd'));
from forms.
@dg isn't possible to fix this on Nette side?
from forms.
If I remember it corectly, addMacro was forpushed,so the impl. may be a mistake.
from forms.
It should be compatible, i.e. flag is optional. Is your macro registered before/after/instead of default macros?
ie. this seems https://github.com/nextras/forms/blob/master/src/DI/FormsExtension.php#L30 that macros are registered each time template is rendered, not only when is compiled.
from forms.
@hrach Check dg commet. Maybe it is solution. Now I am stuck on "Incompatible flags for macro label".
from forms.
Will try asap!
from forms.
I must test it but it is looks like FormsExtension
register Macro different way then LatteExtension
:
If is loaded FormsExtension
and in config.neon is latte.macros: [Nextras\Forms\Bridges\Latte\Macros\BS3InputMacros]
public function create()
{
$service = new Latte\Engine;
$service->setTempDirectory('/var/www/app/../temp/cache/latte');
$service->setAutoRefresh(TRUE);
$service->setContentType('html');
Nette\Utils\Html::$xhtml = FALSE;
//by Latte
$service->onCompile[] = function ($engine) { Nextras\Forms\Bridges\Latte\Macros\BS3InputMacros::install($engine->getCompiler()); };
//by Nextras
Nextras\Forms\Bridges\Latte\Macros\BS3InputMacros::install($service->getCompiler());
return $service;
}
I found this two possibility to solve this, both edit FormExtension::beforeCompile
, but I do not know which is better/right. Both do the same, but different way:
public function beforeCompile()
{
parent::beforeCompile();
$latteExtensionArray = $this->compiler->getExtensions(Nette\Bridges\ApplicationDI\LatteExtension::class);
/** @var Nette\Bridges\ApplicationDI\LatteExtension $latteExtension */
$latteExtension = reset($latteExtensionArray);
$latteExtension->addMacro('Nextras\Forms\Bridges\Latte\Macros\BS3InputMacros::install');
}
public function beforeCompile()
{
parent::beforeCompile();
$builder = $this->getContainerBuilder();
$builder->getDefinition('nette.latteFactory')
->addSetup('?->onCompile[] = function ($engine) { Nextras\Forms\Bridges\Latte\Macros\BS3InputMacros::install($engine->getCompiler());};', ['@self']);
}
I send PR if you say which you prefer, one use knowledge of LatteExtension
, second use knowledge into FormsExtension
how Latte works and how it register macros.
from forms.
Related Issues (20)
- DateTimePicker: Missing seconds support
- Partial rendering not working with BS3 macros HOT 1
- Extension instead of bootstrap copy-pasting? HOT 7
- way to set DateTimePickerPrototype variables HOT 1
- compatibility with nette 2.2.*?
- Not working autoloading. HOT 3
- DatePicker::setRequired() not propagated to javascript HOT 4
- Nevyplněné labely, vycentrování formuláře na střed HOT 5
- Presun volania služby nette.latteFactory z loadConfiguration do beforeCompile HOT 1
- Tag new version HOT 4
- Fix method parameters declaration in BS3InputMacros HOT 2
- Typeahead: nette validation problem when using hint HOT 1
- Bootstrap error rendering HOT 4
- Snippet support HOT 1
- Nette 2.4: DatePicker false invalid result of validation HOT 5
- Undefined variable $_form, did you mean $form? HOT 1
- Undefined variable: _form HOT 5
- add Bs4FormRenderer HOT 1
- Add support for Nette 3 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forms.