Extension talk:Tabs

About this board

Deprecated in MediaWiki 1.42

2
P1ayer (talkcontribs)

Deprecated: Use of MediaWiki\Parser\Parser::$tabsData was deprecated in MediaWiki 1.42. Called from Tabs::init in /var/www/html/extensions/Tabs/includes/Tabs.php at line 35

Gbeine (talkcontribs)
Reply to "Deprecated in MediaWiki 1.42"

Collapsed Tabs Affecting Redirects

1
107.15.19.120 (talkcontribs)

I've recently noticed an issue where if a collapsed tab is above a heading that a Redirect page points to, that redirect goes too far down the page. Is there a solution to this problem?

Reply to "Collapsed Tabs Affecting Redirects"
Kanto501 (talkcontribs)

When I installed this extension on a 1.39.1 version of Mediawiki I get these Deprecation errors:

Deprecated: Required parameter $parser follows optional parameter $attr in /mgi/software/test/mediawiki/extensions/Tabs/includes/Tabs.php on line 60


Deprecated: Required parameter $frame follows optional parameter $attr in /mgi/software/test/mediawiki/extensions/Tabs/includes/Tabs.php on line 60


Deprecated: Required parameter $parser follows optional parameter $attr in /mgi/software/test/mediawiki/extensions/Tabs/includes/Tabs.php on line 142


Deprecated: Required parameter $parser follows optional parameter $attr in /mgi/software/test/mediawiki/extensions/Tabs/includes/Tabs.php on line 225


Deprecated: Required parameter $frame follows optional parameter $attr in /mgi/software/test/mediawiki/extensions/Tabs/includes/Tabs.php on line 225


will these be fixed soon or is something else going on I need to dig in to?

Kanto501 (talkcontribs)

ok I fixed the issues for example on line 60 of the Tabs.php file you need to change:

public function renderTab( $input, $attr = [], $parser, $frame ) {

to

public function renderTab( $input, $parser, $frame, $attr = [] ) {

you would basically do the same thing for lines 142 and 225.

Kanto501 (talkcontribs)

well... now I get this when trying to add tabs to a page:

Warning: Attempt to read property "tabsData" on array in /mediawiki/extensions/Tabs/includes/Tabs.php on line 228


Warning: Trying to access array offset on value of type null in /mediawiki/extensions/Tabs/includes/Tabs.php on line 228


Warning: Attempt to read property "tabsData" on array in /mediawiki/extensions/Tabs/includes/Tabs.php on line 229


Warning: Trying to access array offset on value of type null in /mediawiki/extensions/Tabs/includes/Tabs.php on line 229


I could not figure this out. I wonder if it is related to mediawiki 1.39.1 and using python version 8.0.28 which is my setup?

Xhan (talkcontribs)

python ? PHP you mean? :-)

I have exactly the same problem with :

MediaWiki : 1.39.3

PHP: 8.2.7 (fpm-fcgi)

OS : Fedora 38


Warn :

Warning: Attempt to read property "tabsData" on array in /usr/share/mediawiki/extensions/Tabs/includes/Tabs.php on line 228

Warning: Trying to access array offset on value of type null in /usr/share/mediawiki/extensions/Tabs/includes/Tabs.php on line 228

Warning: Attempt to read property "tabsData" on array in /usr/share/mediawiki/extensions/Tabs/includes/Tabs.php on line 229

Warning: Trying to access array offset on value of type null in /usr/share/mediawiki/extensions/Tabs/includes/Tabs.php on line 229


Internal error :

[ZJGtbOzlGDYpFErl95X7PQAAAEE] /wiki/index.php?title=test Error: Attempt to modify property "tabsData" on array

Backtrace:

from /usr/share/mediawiki/extensions/Tabs/includes/Tabs.php(232)

#0 /usr/share/mediawiki/includes/parser/Parser.php(4023): Tabs->renderTabs()

#1 /usr/share/mediawiki/includes/parser/PPFrame_Hash.php(353): Parser->extensionSubstitution()

#2 /usr/share/mediawiki/includes/parser/Parser.php(2955): PPFrame_Hash->expand()

#3 /usr/share/mediawiki/includes/parser/Parser.php(1610): Parser->replaceVariables()

#4 /usr/share/mediawiki/includes/parser/Parser.php(724): Parser->internalParse()

#5 /usr/share/mediawiki/includes/content/WikitextContentHandler.php(301): Parser->parse()

#6 /usr/share/mediawiki/includes/content/ContentHandler.php(1720): WikitextContentHandler->fillParserOutput()

#7 /usr/share/mediawiki/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput()

#8 /usr/share/mediawiki/includes/Revision/RenderedRevision.php(265): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput()

#9 /usr/share/mediawiki/includes/Revision/RenderedRevision.php(237): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()

#10 /usr/share/mediawiki/includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()

#11 /usr/share/mediawiki/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()

#12 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()

#13 /usr/share/mediawiki/includes/Revision/RenderedRevision.php(199): call_user_func()

#14 /usr/share/mediawiki/includes/poolcounter/PoolWorkArticleView.php(91): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()

#15 /usr/share/mediawiki/includes/poolcounter/PoolWorkArticleViewCurrent.php(97): PoolWorkArticleView->renderRevision()

#16 /usr/share/mediawiki/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleViewCurrent->doWork()

#17 /usr/share/mediawiki/includes/page/ParserOutputAccess.php(299): PoolCounterWork->execute()

#18 /usr/share/mediawiki/includes/page/Article.php(713): MediaWiki\Page\ParserOutputAccess->getParserOutput()

#19 /usr/share/mediawiki/includes/page/Article.php(528): Article->generateContentOutput()

#20 /usr/share/mediawiki/includes/actions/ViewAction.php(78): Article->view()

#21 /usr/share/mediawiki/includes/MediaWiki.php(542): ViewAction->show()

#22 /usr/share/mediawiki/includes/MediaWiki.php(322): MediaWiki->performAction()

#23 /usr/share/mediawiki/includes/MediaWiki.php(904): MediaWiki->performRequest()

#24 /usr/share/mediawiki/includes/MediaWiki.php(562): MediaWiki->main()

#25 /usr/share/mediawiki/index.php(50): MediaWiki->run()

#26 /usr/share/mediawiki/index.php(46): wfIndexMain()

#27 {main}

Reply to "Deprecation errors"
HawkHunter3 (talkcontribs)

Using this plugin, is it possible to edit which tab is active when the page loads?

Example:

<tabs>

<tab name="Hi">Hello there!</tab>

<tab name="Bye" active>Goodbye!</tab>

</tabs>

By adding the active attribute, the second tab will be shown when the page loads, and not just the first tab in the the tab menu.

Is a feature like this possible? I understand you can directly link to a tab, but I want to just have the desired tab load on my page versus using a link to do so.

Joeytje50 (talkcontribs)

I'm very sorry for not getting back to you at all (I didn't get any email notifications about this). This is currently not possible, but it does sound like a good idea to implement. I'll try to get this implemented some time in the future, but this might take a while since I'm in my exam period right now (nice timing on getting back to you now eh?). I'll put this on my to-do list though. Thanks for the suggestion.

109.174.114.72 (talkcontribs)

Any updates on this? It would be nice to preset active tabs, for example inside things like navboxes.

Reply to "Setting "Active" Tab"

Issue: not loading the values for template parameters

8
DWizzy (talkcontribs)

When I create a template with parameters shown in tabs

<tabs><tab>{{{1}}} {{{foo}}} {{{bar|}}</tab></tabs>{{{1}}}{{{bar}}}

the parameters are not loaded when I include the template (eg {{{tabs|one|foo|bar}}}) The parameters outside the <tabs> tag are loaded properly.

Has anyone else experienced this? The (read-restricted) wiki is running Tabs version 1.3.2 on MediaWiki 1.27.8.

Joeytje50 (talkcontribs)

Hi there, there is one problem with your line of code I noticed, namely that your {{{bar|}} is missing a closing bracket. Please first try changing that to see if that fixes it. Otherwise, could you try using the parser-function syntax for the tabs? So, for your line of code, that would be:

{{#tag:tabs|
  {{#tab:| {{{1}}} {{{foo}}} {{{bar|}}} }}
}} {{{1}}}{{{bar}}}

Due to differences in the parsing of different types of functions, some functionality that is supported in the parser-function syntax is not supported in the tag syntax.

Hopefully this helps you!

DWizzy (talkcontribs)

I somehow missed your reply, thank you! :) Silly of me to give an incorrect example. The extra closing bracket didn't resolve it, nor did using the parser-function.

In the end I resorted to using the Extension:Variables parser function {{#var:foo}} after defining mapping all the template parameters to variables.

SciWhiz12 (talkcontribs)

For anyone else experiencing this issue:

I have also encountered this issue recently, and found a solution for it through modifying the extension. Here's a link to the commit which shows the implemented fix: github.com/forgecommunitywiki/mediawiki-extensions-Tabs/commit/20440ea2b2a6a7af438059c57135c2194a166b6b (I seem to be barred from adding a real hyperlink by the abuse filter, oh well).

To summarize it and to preserve the fix in case the link becomes dead, you have to modify the extension's code (includes/Tabs.php) so that the tab extension functions (for both <tab> and <tabs>) take in the extra $frame parameter and pass it into $parser->recursiveTagParse. This gives the parser access to the frame object, which allows it to do variable/parameter substitution.

I might push this change to the upstream repo in the future, but do not plan to do so for now because of my lack of experience in contributing to Wikimedia repos and lack of time to try do so. If anyone wishes to make the change upstream themselves, please feel free to do so (though I'd like to be given a bit of credit if possible).

YOUR1 (talkcontribs)
Jdforrester (WMF) (talkcontribs)

I've landed @YOUR1's patch, which will automatically ship in the REL1_39 branch which will be cut next week.

It could be back-ported to other versions if @Joeytje50 as maintainer wants to, but I don't want to pre-judge.

YOUR1 (talkcontribs)

We do need it in the 1.35 LTS version.

YOUR1 (talkcontribs)

Never mind this message; I'll pin our codebase at 4b1529d

Reply to "Issue: not loading the values for template parameters"

Parser function #tag:tag is not working

1
Kiwibasket (talkcontribs)

Hello! I attempted to use the example in the Usage page, which is the following code:


{{#tag:tabs|

{{#tag:tab|Foo|name={{{1|}}}}}

{{#tab:{{{2|}}}|Bar}}

|style=color:{{#if:{{{1|}}}|green|red}} }}

It keeps rendering single tabs inside the Tabs box rather than adding tabs. It's making it difficult to implement certain templates that I have planned. Is anyone else encountering this? I know there was a thread earlier describing the same problem, and it seems like it still hasn't been fixed.

Reply to "Parser function #tag:tag is not working"

Background Color on Label

1
24.111.201.85 (talkcontribs)

I've looked all over and honestly it isn't very clear when reading about styling under the Usage. How does one change the background color on the label itself. Is that a CSS thing or something I can enter per tab? When I do the background color style it changes the color on the tab and not the label, and color just changes the text color of course.

Reply to "Background Color on Label"
Sokote zaman (talkcontribs)
Reply to "bottom tabs"
LarryAlgo (talkcontribs)
diff --git a/Tabs.body.php b/Tabs.body.php
index 16d12b4..1c30aa9 100644
--- a/Tabs.body.php
+++ b/Tabs.body.php
@@ -398,7 +398,7 @@ class Tabs {
                                '.tabs-dropdown li,'.
                                '.tabs-dropdown ul,'.
                                '.tabs-dropdown ol {'.
-                                       'background-color: '.wfMessage('tabs-dropdown-bgcolor').
+                                       'background-color: '.wfMessage('tabs-dropdown-bgcolor')->text().
                                '}';
                return "<style type=\"text/css\" id=\"tabs-dynamic-styles\">/*<![CDATA[*/\n/* Dynamically generated tabs styles */\n$css\n/*]]>*/</style>";
        }

Found this was interfering with math tags on my page, and dug it down to this. I am not familiar with innards, but this fixed it for me.

~~~~

LarryAlgo (talkcontribs)

Also just to add that I ran into this again, this time with bisecting it to this change:

--- a/Tabs.body.php
+++ b/Tabs.body.php
@@ -92,7 +92,7 @@ class Tabs {
                        if (isset($names[$index-1])) { // if array $names already has a name defined at position $index, use that.
                                $name = $names[$index-1]; // minus 1 because tabs are 1-based, arrays 0-based.
                        } else { // otherwise, use the entered name, or the $index with a "Tab " prefix if it is not defined or empty.
-                               $name = trim(isset($attr['name']) && $attr['name'] ? $attr['name'] : wfMessage('tabs-tab-label', $index));
+                               $name = trim(isset($attr['name']) && $attr['name'] ? $attr['name'] : wfMessage('tabs-tab-label', $index)->text());
                        }
                }
                if (!$nested && !$nestAttr) { // This runs when the tab is not nested inside a <tabs> tag.

I also noticed the pattern and went ahead and changed found all my "wfMessage" and added ->text(). I'm still an amateur to mediawiki.. I can sent a patch when I'm in an easier place to do so.

Reply to "Minor bug?"
Knetschkäfer (talkcontribs)

I tried everything but the tabs do not work. I write:

<tabber>
|-|1=
Test

|-|2=
Test

|-|3=
Test

</tabber>

but it does not work. The tabbers are shown but they don't work.


Please can someone help me? The tabs are very important to our wiki.


Thank you!

Knetschkäfer (talkcontribs)

Here is a test page from my wiki: wiki.silverfang.net/Tabber_Test_Page

Joeytje50 (talkcontribs)

Apologies for the late reply. As it seems, on that linked page, the tabs extension to which you are commenting here, does seem to work fine. This extension does not include the Tabber extension, which is its own extension. If you want to use that, you can install it separately, but the tabs do function just fine the way you show on that linked page.

Reply to "Tabs do not work"
Return to "Tabs" page.