This topic is locked

AddTab vs WhereTabs::addTab

5/12/2023 10:48:12 AM
PHPRunner General questions
mbintex author

AddTab
https://xlinesoft.com/phprunner/docs/addtab_pageclass.htm
WhereTabs::addTab
https://xlinesoft.com/phprunner/docs/addtab_where_tabs_api.htm
Both can add WhereTabs to a list view page, but AddTab is deprecated following the manual.
I ask myself why?
AddTab could be used in BeforeProcess Events where $pageObject is available. So I could add or hide and delete tabs based on the page which I get with $pageObject->pageName. That is nice.
WhereTabs::addTab only works in the aftertableinitialized Event. But in this event I only get the table name as $table, no info about the page is available. Therefor this API is useless, if I want to add or hide a WhereTab only on certain list pages.
Is this intended? Are there alternatives for my usecase or is the WhereTabs-API documentation not complete or wrong and I can use it on other events too?

Sergey Kornilov admin 5/12/2023

In this specific case you can use old, deprecated API. It is not going anywhere for now.
Unfortunately, $pageObject is not available in AfterTableInit event as this event is called before this object is created. We will see if we can offer an alternative way to access the name of the current page.

mbintex author 5/13/2023

Thanks, good to know, that the deprecation does not mean anything for now and there hopefully will be an equivilant if it goes away.