Is it possible to hide the grey bar where buttons would normally go in an administrator view of a custom component? The grey bar shown below:

Joomla admin bar example

I have no buttons to show, so don't want it to take up space. I could use CSS I imagine, but wondered if there's another way.

up vote 1 down vote accepted

In your default admin template folder (for example: yourjoomla/administrator/templates/isis/css) you can create a custom.css file in which you can define:

.subhead-collapse collapse {
    height: 0px;
    visibility: hidden;
}

Then that grey field will disappear and it is done.

Or in ths same temlplate folder, you can find your index.php file (you should make a template override of that file) then you could delete (or comment out) the subhead parts of that template Subhead divs.

after this line of the index.php:

<!-- Subheader -->

In isis admin template it is at the line 265.

However, it is important that in this divisions of the admin template you will find the component option button which is kind of important button of a component, at the right side of this grey field. Of course you can customize that too...

  • Thanks for this - in the end I simple added some inline CSS to this particular view of my component, as it's the only view where I don't want the button bar. – codinghands Nov 21 at 11:38
  • Yes, that's the best place you can place this short css. I forgot to include that. :) – Zollie Nov 21 at 12:16

Just looking into how that bar is generated. It is part of the Isis administrator template.

In line 58 of \administrator\templates\isis\index.php there is the code

$cpanel   = $option === 'com_cpanel';

This checks to see if we are on the control panel page, and if so sets the variable $cpanel to true. This variable is then used later (line 264) to see whether to display the subheader (the button bar)

<?php if (!$cpanel) : ?>
    <!-- Subheader -->
    <a class="btn btn-subhead" data-toggle="collapse" data-target=".subhead-collapse"><?php echo JText::_('TPL_ISIS_TOOLBAR'); ?>
        <span class="icon-wrench"></span></a>
    <div class="subhead-collapse collapse" id="isisJsData" data-tmpl-sticky="<?php echo $stickyBar; ?>" data-tmpl-offset="<?php echo $offset; ?>">
        <div class="subhead">
            <div class="container-fluid">
                <div id="container-collapse" class="container-collapse"></div>
                <div class="row-fluid">
                    <div class="span12">
                        <!-- target for skip to content link -->
                        <a id="skiptarget" class="element-invisible"><?php echo JText::_('TPL_ISIS_SKIP_TO_MAIN_CONTENT_HERE'); ?></a>
                        <jdoc:include type="modules" name="toolbar" style="no" />
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php else : ?>

Basically, it shows on every page except the control panel and there appears to be no external parameter you can send to turn it off.

Whilst it would be possible to override line 58 to also set $cpanel to true if it matches your component's name, overriding core code isn't a great idea and cloning the template for a single non-vital change also seems a bad move.

I think your CSS solution is going to be the best approach.

  • Thanks for looking into this so thoroughly. Considering all this the CSS one-liner is definitely easiest I think! – codinghands Nov 21 at 11:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.