Articles doesn’t haev a ‘hide from menu’ checkbo, which is tricky when youw ant a client to check the article before posting it live.
I found an old snippet written by Bob Ray (Thanks as ever Bob!) which allows the admin to use a checkbox TV to hide the article from menus using this snippet:
Ah Ok brilliant - thank you!
So I’ve done that but it’s not doing anything.
In the code of the plugin, I can’t work out what value it’s lookng for - it just says;
if ($resource->getTVValue('HideMenu')) {
My TV is set up liike this:
Input Option Values
Yes==1
And it’s checked in the Article.
Do I need to do anything to get that plugin to run?
Thinking about it - there’s nothing in the call to the resources to say 'only show artciels that aren’t ‘hide form menu’. It’s not sert up like getResources.
In The Artciels Advanced Settings I have a field which says:
Other Listing Parameters:
So I’ve added &showHidden=0
But then no stories appear in my listing!
I’ve added the name of the TV in the Include TVs List
Right - so I’ve checked the DB and I realises that by default - all Arrticle resources are set to hide from menu! (which is why none are showing when I added the Listing Parameter!’.
So I guess I could reverse it so that you have to check the box to Show in menu - but it feels a bit counter intuitive?
Sorry for all the comment - so The checkbox isn’t ctuslly doing anything at all.
I have tried reversing the process tso that if it’s checked, it changes the value in the database to ‘0’ - but it doesn’t. All new articles are ‘1’ in the hide from menu column in the database.
Back to square one - just when I thought I was getting somewhere!
Is the name of your TV “HideMenu”?
Maybe you could add some log()-commands to your code and then check the error log to make sure, the plugin is even executed.
Although it says here that there is “no need to run the $resource->save() method as that happens automatically”, I can only see the change in the database when I actually call $resource->save();.
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.