Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latte pass RecursiveComponentIterator instead of original value #194

MartkCz opened this issue Aug 5, 2019 · 2 comments

Latte pass RecursiveComponentIterator instead of original value #194

MartkCz opened this issue Aug 5, 2019 · 2 comments


Copy link

@MartkCz MartkCz commented Aug 5, 2019

Version: 2.5.2

Works in 2.5.1

{define container $val, $options}
	{var $options = $options ?: new App\UI\Options()}

	<div n:tag-if="$options->getColumns()" class="row">
		{foreach $val as $ctrl}
			<div n:tag-if="$options->getColumns()" n:class="$options->getColumnClass()">
				{if $ctrl instanceof Nette\Forms\Container}
					{include container $ctrl->getComponents(), $ctrl->getOptions()}

					{dump $ctrl}
					{include controlContainer $ctrl}



{define controlContainer $val}
	{dump $val}
	<div n:if="!$val->getOption(rendered) && $val->getOption(type) !== hidden"
			n:class="form-group, $val->required ? required, $val->error ? has-error"
			n:attr="id => $val->getOption(id)">

		{if $val->getOption(type) === file}
			{php $val->getControlPrototype()->addClass('ctrl-inline')}
			{include control $val}

		{elseif $val->getOption(type) === radio}
			{include radio $val}

		{elseif $val->getOption(type) === checkbox}
			{include checkbox $val}

			{include control $val}


First dump is WebChemistry\Images\Controls\UploadControl (in container), second dump is Nette\ComponentModel\RecursiveComponentIterator (in controlContainer)

Error: Call to undefined method Nette\ComponentModel\RecursiveComponentIterator::getOption()


When I dump this latte code:

Tracy\Debugger::barDump(($ctrl), '$ctrl');
bdump([$ctrl] + get_defined_vars());
$this->renderBlock('controlContainer', [$ctrl] + get_defined_vars(), 'html');

dump is

@dg dg pinned this issue Aug 5, 2019
Copy link

@dg dg commented Sep 13, 2019

Can you try if this helps? 276c390

Copy link
Contributor Author

@MartkCz MartkCz commented Sep 17, 2019

Probably yes (updated to master and without Exception)


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants