Active
Project:
Block Tabs
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
11 Oct 2020 at 13:53 UTC
Updated:
29 Apr 2023 at 11:59 UTC
Jump to comment: Most recent
How would i go about making the Tab titles dynamic? Specifically, each tab has a view in it and i want the tab title to include the number of results in that tab's view. My guess is i would need to make a new plugin? Any hints?
Comments
Comment #2
liquidcms commentedComment #3
liquidcms commentedI think I am close. I extended the ViewsTab class and removed the parts i didn't need. In the getContent() method i can see $this->title as the default tab title and using $this->title = 'XXX' or $this->setTitle('XXX') i can see in the code this value is changed - but it has not impact on the title/label.
Comment #4
liquidcms commentedHmm, not setTitle(), but getTitle() can be overridden to return a different title. But it runs before the content of the tab is run. I can rerun the view again but less efficient to run it twice. I guess i could redo the getContent() to grab from cache stored during getTitle; but seems wrong.
Comment #5
liquidcms commentedno, getTitle doesnt work either as it just adds to the stored value every time the config page (or possibly view page) is hit.. so tab titles ends up as My title (10) (10) (10) (10) after a while.
Comment #6
TMurray commentedWould be really useful if this tab totals feature could be built directly into the module.
Comment #7
g089h515r806 commentedYou can do it with JS and CSS.
1.Display the total number in the tab view, hide it.
2.Using js display the total number to title.