Skip to content

Update SiteApplication.php to initialize properly the template object caused by #30192#30360

Closed
joeforjoomla wants to merge 12 commits intojoomla:4.0-devfrom
joeforjoomla:patch-2
Closed

Update SiteApplication.php to initialize properly the template object caused by #30192#30360
joeforjoomla wants to merge 12 commits intojoomla:4.0-devfrom
joeforjoomla:patch-2

Conversation

@joeforjoomla
Copy link
Copy Markdown
Contributor

@joeforjoomla joeforjoomla commented Aug 13, 2020

Related to #30192

Summary of Changes

Add the new properties 'parent' and 'inheritable' to the object initialized in the 'setTemplate' method so that there are no 'Notice' if a plugin calls the 'setTemplate' method to override the template used

Testing Instructions

Call the 'setTemplate' method from a system plugin

Actual result BEFORE applying this Pull Request

Notice for undefined property 'parent'
image

Expected result AFTER applying this Pull Request

No PHP notice

Documentation Changes Required

No

@joeforjoomla
Copy link
Copy Markdown
Contributor Author

@dgrammatiko you are here

@dgrammatiko
Copy link
Copy Markdown
Contributor

@joeforjoomla sure something I overlooked, but I guess hardcoding the params to null and 0 will only work for the legacy mode. The function should be like:

	public function setTemplate($template, $styleParams = null, $inheritable = 0, $parent = '')
	{...}

So it can work for all cases

@joeforjoomla
Copy link
Copy Markdown
Contributor Author

joeforjoomla commented Aug 13, 2020

Yes @dgrammatiko actually the setTemplate should have new parameters to allow setting both new properties. That would be ideal.

@joeforjoomla
Copy link
Copy Markdown
Contributor Author

@joeforjoomla i've updated this PR accordingly

Both inheritable and parent are params from the template_styles table, so it makes sense to keep them consistent
@dgrammatiko
Copy link
Copy Markdown
Contributor

@joeforjoomla @wilsonge I was wrong here, we don't need to change the signature of the function, check joeforjoomla#1

wilsonge and others added 2 commits August 13, 2020 21:24
Co-authored-by: Quy <quy@fluxbb.org>
Co-authored-by: Quy <quy@fluxbb.org>
@richard67
Copy link
Copy Markdown
Member

Testing Instructions

Call the 'setTemplate' method from a system template

@joeforjoomla From a system template? Or from a system plugin?

@joeforjoomla
Copy link
Copy Markdown
Contributor Author

@richard67 ops sorry.. obviously system plugin

@richard67
Copy link
Copy Markdown
Member

No problem, can happen.

@richard67
Copy link
Copy Markdown
Member

Unit test failure is not related to this PR.

@joeforjoomla
Copy link
Copy Markdown
Contributor Author

I have tested this item ✅ successfully on 578166f


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30360.

@richard67
Copy link
Copy Markdown
Member

@joeforjoomla It doesn't make sense to test your own PR since the rules say that when you propose a PR, you have to test it yourself anyway.

@dgrammatiko
Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 578166f


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30360.

@JoeJoomlaCoder
Copy link
Copy Markdown

I have tested this item ✅ successfully on 578166f


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30360.

@joeforjoomla
Copy link
Copy Markdown
Contributor Author

RTC

@Quy
Copy link
Copy Markdown
Contributor

Quy commented Sep 4, 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30360.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Sep 4, 2020
@infograf768
Copy link
Copy Markdown
Member

Back to pending as there are unaddressed comments.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30360.

@infograf768 infograf768 removed the RTC This Pull Request is Ready To Commit label Sep 5, 2020
@Quy Quy added the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Sep 5, 2020
@richard67
Copy link
Copy Markdown
Member

@joeforjoomla Is @JoeJoomlaCoder also an account from you?

@rmittl
Copy link
Copy Markdown

rmittl commented Oct 17, 2020

I have tested this item ✅ successfully on 578166f

Called setTemplate() method in a System Plugin -> PHP Notice
After applied Patch -> no PHP Notice Warning


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30360.

@rmittl
Copy link
Copy Markdown

rmittl commented Oct 17, 2020

Called setTemplate() method in a System Plugin -> PHP Notice
After applied Patch -> no PHP Notice Warning
Tested successfully


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30360.

@richard67
Copy link
Copy Markdown
Member

This PR still has open review comments and also fail the PHP code style test by drone.

For fixing the latter I'll suggest a correction in a minute.

But as long as the review comments are not addressed I can't really set RTC.

@rmittl
Copy link
Copy Markdown

rmittl commented Oct 17, 2020

Sorry, my fault. The issues Joomla Site update not correctly after posting "Test this". So I post it again and it was double.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30360.

Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
@joeforjoomla
Copy link
Copy Markdown
Contributor Author

@richard67 any update on this? Can we get it merged quickly? What is still missing?

@dgrammatiko
Copy link
Copy Markdown
Contributor

@joeforjoomla please address this comment #30360 (comment)

@joeforjoomla
Copy link
Copy Markdown
Contributor Author

@dgrammatiko i don't think that #30360 is a good idea, having a string or an object assigned to the property $this->template->template is not an option, indeed extension have always assumed that this is a string matching the template name. However #30360 is quite unrelated to this PR.

@dgrammatiko
Copy link
Copy Markdown
Contributor

dgrammatiko commented Jan 19, 2021

having a string or an object assigned to the property $this->template->template is not an option

I guess that was an example code and they meant $this->template = $template. The $this->template->template is the value of the db - > table extensions -> column element and it's a string. Other than that the suggestion is solid and tbh expected behaviour

@joeforjoomla
Copy link
Copy Markdown
Contributor Author

Ok but honestly i don't understand what i should do here in relation to this PR. Eventually that can be merged as a separate PR.

@joeforjoomla
Copy link
Copy Markdown
Contributor Author

This is still an issue. What to do to merge a fix?

@brianteeman
Copy link
Copy Markdown
Contributor

Creating a fake account in order to mark that you had tested something doesnt really inspire people to accept that test result.

If you want people to test something that is not trivial then you need to give test instructions that are easy to follow

@joeforjoomla
Copy link
Copy Markdown
Contributor Author

@brianteeman this is an open bug, nobody is interested to create fake accounts but just fix the Joomla code

small change to let ci running
@richard67
Copy link
Copy Markdown
Member

Closing in favour of #32710 . @joeforjoomla Sorry, I hope you are not too angry or disappointed. Feel free to re-open here if you think it is a mistake that I closed it.

@richard67 richard67 closed this Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Updates Requested Indicates that this pull request needs an update from the author and should not be tested.

Projects

None yet

Development

Successfully merging this pull request may close these issues.