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
[#34027] Add ability to override the renderer [New feature] #4052
Conversation
In Joomla! if you want to override something you have to put it in the active template directory (e.g.: the layouts goes in (active template)/html/layouts). This PR introduces the ability to override the whole rendering process in the template by copying (and modifying per your preferences) the /libraries/joomla/document directory. It is shouldn't rise any backward compatibility issues (except that the directory [active template]/document might be in use?). What this might provide? Flexibility on the way that the template renders (the inner logic) the data. e.g. someone may use echo $this->getBuffer('modules', 'menu', array('menu', 'html5')); and remove the <jdoc..> parser. Why? Because this is one area that if you want to override and use your own logic you have to do it through a plugin (this is way easier and cleaner)
* @var string | ||
* @since 3.4 | ||
*/ | ||
public $_file = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't start the property name with an underscore. According to our coding standards we only use a starting underscore for private properties (yes I know there are wrong named properties already there).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I have to study harder the coding standards... :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I declare public $_file = ‘’;
tests pass but cs fail. The other way around seems failing the tests so I am little bit confused here. Also all the other variables in the same array have similar key names $_profile
. What am I missing here?
You need to make the change to the property name also in the later checks to |
You need to change |
The error was that you changed the property declaration correctly from |
In the logic the var is |
Test istructions:Apply the patch What you can do if this gets accepted?Because renderers are the place where the code gets from arrays and strings to actual html, xml, raw, feed or json, you can do pretty much whatever you want. |
Declaring the property in the unit test certainly is the wrong approach to fix it. That will never be accepted. Currently I'm wondering where you intend to set the |
Also you're restricting this feature now only to the frontend. Why? |
Ok, I’ll give it another try… |
Ah, so Then of course we can't rename it, sorry for that then. But imho it should still be initialised. |
Found it. It's used in JDocumentError (https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/document/error/error.php#L131) and JDocumentHtml (https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/document/html/html.php#L572). |
Maybe something like this will make a good fit: |
No, that looks like messy code to me. |
Actually the code as i tested will be like
|
That looks fine, yes. |
On the other hand additional renderers |
This PR got really meshy, therefore I am closing it and opening a new one. I forgot: Big thanx to Thomas @Bakual for his help! |
In Joomla! if you want to override something you have to put it in the active template directory (e.g.: the layouts goes in (active template)/html/layouts).
This PR introduces the ability to override the whole rendering process in the template by copying (and modifying per your preferences) the /libraries/joomla/document directory.
It shouldn't rise any backward compatibility issues (except that the directory [active template]/document might be in use?).
What this PR might provide to Joomla! devs/users?
Flexibility on the way that the template renders the data (the inner logic). e.g. someone may use
echo $this->getBuffer('modules', 'menu', array('menu', 'html5'));
and remove the<jdoc.. >
parser.Why?
Because this is one area that if you want to override and use your own logic you have to do it through a plugin (this is way easier and cleaner)
Feature tracker: http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=34027