Wrap Tab/Accordion Heading with

Permalink Browser Info Environment
Is there a relatively simple way to wrap the tab heading text with <h2></h2>? I don't want to modify the styling to match the theme's H2 styling, I just want the header text to render as H2 and inherit that style.

No other issues so far-- many thanks for developing something so incredibly useful!

1 Attachment

Type: Ticket
Status: Resolved
mmartinpdx
View Replies:
JohntheFish replied on at Permalink Reply
JohntheFish
The way MT wraps tab headings is defined by the tab block template. None of the existing templates use <hx>, so you will need to create your own template as described inhttps://c5magic.co.uk/addons/magic-tabs/developing-tab-templates...

Not that the code in a MT template provides a proforma, it is not the actual code used, but a representation which is then manipulated and replicated by MT to wrap blocks.

Taking the default template as an example, and calling the new template jl_magic_tabs_default_h2, the important part would be something like:
<div id="<?php echo $setname; ?>_proforma"
         class="ccm-ui jl_magic_tabs_proforma jl_magic_tabs_default_h2 <?php echo $setname; ?>"
         style="display:none;"
         data-selected-class="active
    >
        <ul id="<?php echo $setname; ?>_proforma_inner_container"
            class="nav-tabs nav" role="tablist">
            <li id="<?php echo $setname; ?>_proforma_tab_element" class="nav-item" role="tab">
               <h2><a class="nav-link"></a></h2>
            </li>
        </ul>
        <div style="clear:both"></div>
    </div>


Whilst this wraps the tab heading links in an <h2>, the actual styling will be whatever the theme css does under such circumstances.
mmartinpdx replied on at Permalink Reply
mmartinpdx
so, this code adopts the <H2></H2> styling but doesn't do anything:
<ul id="<?php echo $setname; ?>_proforma_inner_container"
            class="magic_tabs" role="tablist">
            <li id="<?php echo $setname; ?>_proforma_tab_element" role="tab">
            <h2><a class="nav-link"></a></h2></li>
        </ul>


whereas this code works but retains default tab styling:
<ul id="<?php echo $setname; ?>_proforma_inner_container"
            class="magic_tabs" role="tablist">
            <li id="<?php echo $setname; ?>_proforma_tab_element" role="tab">
            <a class="nav-link"><h2></h2></a></li>
        </ul>


If I inspect the rendered HTML, I don't even see "<h2></h2>".

I think my best option at this point is to just address this via CSS and style the anchor tag to match the theme's default styling for H2. There's no non-presentation case for the header tag that justifies further modification to code that works just fine as is.

We can mark this one as 'resolved'-- many thanks for your time!
JohntheFish replied on at Permalink Reply
JohntheFish
I am not surprised. The styling of tabs comes from the tabs css, so I would expect to be stronger than anything that could come from the theme, even when the tabs render with H2 elements.

As you have suggested, adjusting the font/size of the tabs in the css of your template and forgetting the actual H2 elements will be the best option going forwards.

concrete5 Environment Information

# Concrete Version
Core Version - 9.2.8
Version Installed - 9.2.8
Database Version - 20240122172319

# Hostname
us-phx-web1288.main-hosting.eu

# Environment
production

# Database Information
Version: 10.11.7-MariaDB-cll-lve
SQL Mode: NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Character Set: utf8mb4
Collation: utf8mb4_unicode_ci

# Concrete Packages
Block Builder (2.6.1), Form Reform (9.3.15), Form Reform Attributes, Express and Users (9.0.15), Form Reform Developer (9.0.8), Form Reform Display (9.1.1), Light Slider (2.0.1), Magic Tabs (9.0.8)

# Concrete Overrides
None

# Concrete Cache Settings
Block Cache - Off
Overrides Cache - Off
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Database Entities Settings
Doctrine Development Mode - Off

# Server Software
LiteSpeed

# Server API
litespeed

# PHP Version
8.1.27

# PHP Extensions
bcmath, bz2, calendar, Core, ctype, curl, date, dom, exif, fileinfo, filter, ftp, gd, gettext, gmp, hash, iconv, igbinary, imagick, imap, intl, json, libxml, litespeed, mbstring, memcached, monarxprotect, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, pdo_sqlite, Phar, posix, readline, redis, Reflection, session, shmop, SimpleXML, soap, sockets, SPL, sqlite3, standard, sysvmsg, sysvsem, sysvshm, tidy, timezonedb, tokenizer, xml, xmlreader, xmlrpc, xmlwriter, xsl, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 360
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 360
max_input_vars - 5000
max_multipart_body_parts - -1
memory_limit - 2048M
post_max_size - 2048M
upload_max_filesize - 2048M
zend.exception_string_param_max_len - 15
mbstring.regex_retry_limit - 1000000
mbstring.regex_stack_limit - 100000
memcached.sess_lock_max_wait - not set
memcached.sess_lock_wait_max - 150
memcached.sess_server_failure_limit - 0
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
redis.pconnect.connection_limit - 0
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
soap.wsdl_cache_limit - 5
unserialize_max_depth - 4096
opcache.jit_bisect_limit - 0
opcache.jit_max_exit_counters - 8192
opcache.jit_max_loop_unrolls - 8
opcache.jit_max_polymorphic_calls - 2
opcache.jit_max_recursive_calls - 2
opcache.jit_max_recursive_returns - 2
opcache.jit_max_root_traces - 1024
opcache.jit_max_side_traces - 128
opcache.max_accelerated_files - 10000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (X11; Linux x86_64; rv:124.0) Gecko/20100101 Firefox/124.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.