Css for ToolbarHelper Topic is solved

For Joomla! 4.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Locked
Slushgood
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 140
Joined: Tue Sep 22, 2015 1:04 pm
Location: St palais sur mer, France

Css for ToolbarHelper

Post by Slushgood » Mon May 23, 2022 3:38 pm

Hi,
I am looking for how to recover the css of my toolbar in Frontend. In the example below:: spacer disappears.

Code: Select all

	public function display($tpl = null)
	{
	...
		echo $this->renderToolbar();		
		return parent::display($tpl);
	}
	
	protected function renderToolbar(): string {

	    ToolbarHelper::link($url=$url_List, $text='Liste', $name = 'list');
	    ToolbarHelper::spacer($width= '10px');

	    ToolbarHelper::link($url=$url_Galery, $text='Gallery', $name = 'grid');
	    ToolbarHelper::back();
	    
	    return Toolbar::getInstance()->render();
	}
If i watch code in dev tool no class insert in frontend.
result.jpg
Thanks for your help
You do not have the required permissions to view the files attached to this post.

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2626
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Css for ToolbarHelper

Post by ceford » Mon May 23, 2022 10:32 pm

You could try using the $toolbar->standardButton instead of Toolbar::Helper:

Code: Select all

		// Get the toolbar object instance
		$toolbar = Toolbar::getInstance('toolbar');
		...
		$toolbar->standardButton($language->code)
		->text($language->title)
		->buttonClass('set-language border-bottom')
		->task('xxxx.default')
		->icon($icon);

Slushgood
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 140
Joined: Tue Sep 22, 2015 1:04 pm
Location: St palais sur mer, France

Re: Css for ToolbarHelper

Post by Slushgood » Wed May 25, 2022 8:22 am

Thank you Ceford for that answer.
But where should I put this code ? In HtmlView ?

Slushgood
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 140
Joined: Tue Sep 22, 2015 1:04 pm
Location: St palais sur mer, France

Re: Css for ToolbarHelper

Post by Slushgood » Wed May 25, 2022 9:06 am

Ok i've found my answer.
https://api.joomla.fr/joomla3/dd/dc8/cl ... utton.html
But same problem, i have no class on the button.

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2626
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Css for ToolbarHelper

Post by ceford » Wed May 25, 2022 9:09 am

Rare to see a Toolbar in the front end! I use an addToolbar() function in the HtmlView file, just like in the backend. But I don't call it from there. I call it from the tmpl/default.php file:

<?php $this->addToolbar(); ?>

I don't remember why I decided to do it this way!

User avatar
ceford
Joomla! Hero
Joomla! Hero
Posts: 2626
Joined: Mon Feb 24, 2014 10:38 pm
Location: Edinburgh, Scotland
Contact:

Re: Css for ToolbarHelper

Post by ceford » Wed May 25, 2022 9:37 am

Have a look at layouts/joomla/toolbar/link.php - the class gets applied to the a tag. You may need to create an override.

Slushgood
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 140
Joined: Tue Sep 22, 2015 1:04 pm
Location: St palais sur mer, France

Re: Css for ToolbarHelper

Post by Slushgood » Tue May 31, 2022 2:42 pm

Thank you ceford for all this informations.
You are probably right about how to do it. I am self-taught so I will have to go back to my way of proceeding with this toolbar. For the moment it works as is. But when my project is over if I see the end one day :-) I will surely come back


Locked

Return to “Joomla! 4.x Coding”