Setting Add Uikit to No breaks frontend view #163
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: joomla/Component-Builder#163
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
It looks like the view by default tries to load the Uikit even if you set it to no in Libs & Helpers of the component
I have not found this to be true, but will have a look at it, you can check the code in the view.html.php
Here is the XML of those switches
So you can see that
uikit_load
-> 2 = do not load and in the code 2 stops any of those codes to load. This means if it still loads after turning it off, it could be your browser memory.While debugging I saw that it broke because of this line in the generated model. I had to comment it out for the code to run without the uikit
// Checking if player_evaluation has uikit components that must be loaded. $this->uikitComp = RcsrankingsHelper::getUikitComp($data->player_evaluation,$this->uikitComp);
I think maybe an if here to perform a check first before trying to load it.
Hmmm this can not be the issue. I know that line in the model triggers the loading of the class names if it finds any in the content. IT places those class names in
$this->uikitComp
but the view only acts on that array if$uikit
is not 2. So even if that methodgetUikitComp()
in the model finds UIKIT classes in your code it will not load UIKIT.So something does not make sense.... here is the helper method
As you can see it does not load any files to the header of the document. It simply looks for UIKIT strings and then if found adds it to the array, so to dynamically add those components to the page. It can not load Uikit unless
$uikit
is not 2I mean look here in the view at the following code
This is when it loads the result from the
getUikitComp()
method into the view, and as you can see it is after the if statement that checks that$uikit
is not 2Ok,
I'll unload it and see if it still does it and if so I'll step into that function and see what inside there is the bad guy and let you know what I find.
So if you in the
_prepareDocument()
do avar_dump($uikit)
what do you get?If it is 2 then go into the if statements, and do a
jexit();
and see if it actually enters the statement.I am sure you will see that it does not if the
$uikit
is 2Yeah, PhpStorm won't even step into it, it goes straight to save the session and close.
So here's the feedback from the IDE:
The fact that your IDE does not find the method does not mean it is not on the page. It is on the page because the helper class is being loaded and it is default to all helper classes build by JCB. So you can check this.
Open the helper class
/site/components/com_rcsrankings/helpers/rcsrankingshelper.php
do a search in the file for the methodgetUikitComp
you will find the method there.Then in the main site file of the component
/site/components/com_rcsrankings/rcsrankings.php
You will see the following lines
File added via the Joomla JLoader are not picked up by most IDE's so you can not use the IDE to test your code, you must run Joomla and debug in the browser most of the time.
Netbeans is far better at this (seeing that classes are on the page) then any of the jetbrains IDEs... I have the full suite of jetbrains IDE's and yet hardly ever use them, Netbeans does what they do per IDE all in one, so I can code BASH, c++, JAVA and PHP and many more at the same time in NETBEANS, give it a try ;) and it is free...
I checked and that method is no where in the component's folder
It only exists when I choose to add the Uikit.
Are you telling me that the helper class is not in the helper folder?
Okay you don't understand how things work it seems.
Here's the helper file
I'm just saying that method is not in my helper class
Okay maybe I don't understand what you are doing. What do you mean with
Because of course it will only be added if you add UIKIT to your component. And if you do not then the code from your model that uses that method will also not be added. They are controlled by the same switch.
That's the problem, the code that calls it is in my model. But the method is not.
Sorry if I don't understand how things work.
I'll just keep installing the Uikit to avoid the problem.
I am not talking about JCB, but PHP :) it seemed for a moment that you don't understand PHP. But okay my bad... lets putt it this way.
This is possibly an error on your part. I can not fix what I can not see.
The reality is I can spend another hour showing you that what you are saying can not be true... but man I do not have time to do that now.
But know that the compiler has one global switch for the UIKIT to be added, and that switch is what triggers the method to be added and also that the check in the model be added. I can take a look at this again... I can also point you into the direction of the code if you are willing.
Sure, point me to the code, I'm willing
So I found where the compiler is adding it to my model and it appears to be adding it because I'm using the field type of "editor" which is named "player_evaluation" does that help maybe.
We have one over sized file e_Interpretation.php in the compiler that has to re-factored at some point. I already started doing this, and that is why there is now 6 files that work as one called the compiler.
So the interpretation of the JCB switches and tweaks are all happening in that file at this point.
So there is a class variable called
$this->uikit
if you search in the interpretation you will find this variable is used all over the place. You will see this variable gets set in the get file of the compiler. Following this variable will take you to all the place, or almost all the places that are linked to the UIKIT.The method that adds the function is found on line 2270 of the interpreter.
The method that adds the check in the model is done over a few places working together. since some views have fields that is seen as content fields that could be using UIKIT styles.
So to follow the logic take a little more research... good place to start your research will be line 2755 in the interpreter, then try to follow the logic back... I mean try to see how
$this->siteFieldData
array is build in the fields file of the compiler.You will see on line 1270 of the fields file it loads the array. Hmmm I think I found it... lets add the global checker in here and see if it resolves your issue.
Sorry man.. hope you understand that trailing... I mean pointing you to the code... this helped me see things that I do not always remember. But okay, I don't mind acknowledging that I might have been wrong in thinking it can't happen.
So here is what you can try... on line 1270 add the following.
Let me know.
If it still does not resolve the issue... then I will look at it next week.
Yes, adding the line you suggested solved the problem.
Thanks and sorry for all the back and forward.