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

how to pass data from component to the parent view #70

Open
twentyfortysix opened this issue Apr 15, 2021 · 0 comments
Open

how to pass data from component to the parent view #70

twentyfortysix opened this issue Apr 15, 2021 · 0 comments

Comments

@twentyfortysix
Copy link

Hi,
I've been struggeling with this for a while.

I'm used to Twig and its inheritance thru blocks outside of this Joomla enviroment.
But the blocks in joomla has no power over the joomla native inheritance in many cases.

In a nutshell:
Say we have index.php in the template root where the $this includes many data but the article content which is available in the <jdoc:include type="component" /> and not in its parent view.

specifically:
the index.php loads a article.html.twig that extends base.html.twig..
The article.html.twig is populated by needed data from the index php like so:

$data = array(
	'sitename' => htmlspecialchars($app->get('sitename'), ENT_QUOTES, 'UTF-8'),
	'site_url' => JUri::base(),
..

That is all fine we can play with the data we prepared in the main index.php
The data by the Joomla nature does not have the article data yet. They are loaded as part of the "component". One might think we can make a block placeholder and fill it up from the child component view. But that does not work here.
It is a bit of a problem as if we for example want to load extra_fields from the com_k2 outside its own view we are out of luck.. or at least I am. As I still heaven't found how to send share data from child view to parent view.

It would be awesome to have something like jmodule_get_module for components. That will allow us to get the component data as such and play with the dat in their raw form anyway we like in any time and place we like.
Hope I'm understood a bit.

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

No branches or pull requests

1 participant