Custom Classes for Blocks
Permalink
I have created custom classes, but they are not showing up. When I click on a block, and choose Design & Custom Template, there is nothing in the Custom Class box to choose from.
This is my code ... what have I done wrong? These classes ARE in my stylesheet, FYI.
public function getThemeBlockClasses()
{
return array(
'image' => array(
'img-border-padding'
),
'image' => array (
'img-circle'
),
'*' => array(
'padded-yellow-bg'
)
);
}
Thank you.
This is my code ... what have I done wrong? These classes ARE in my stylesheet, FYI.
public function getThemeBlockClasses()
{
return array(
'image' => array(
'img-border-padding'
),
'image' => array (
'img-circle'
),
'*' => array(
'padded-yellow-bg'
)
);
}
Thank you.
Thank you for getting back to me. I do have a page_theme.php page which is in my theme directory, and the theme is installed and activated. I will try taking a peek at the Elemental theme code and see if it can point me in the right direction. I wish there was better documentation for accomplishing this! :/
Thanks for your help.
Thanks for your help.
There is some documentation available related to this subject.
https://documentation.concrete5.org/developers/designing-for-concret...
But still, it is a good thing to look in the core to see how things are done.
Goodluck.
https://documentation.concrete5.org/developers/designing-for-concret...
But still, it is a good thing to look in the core to see how things are done.
Goodluck.
Thank you. One question ... does the stylesheet have to be in a folder called css, or can it be named anything?
If you use Concrete to compile the less the answer is yes.
The getStylesheet method calls the getStylesheetObject. In here the constant DIRNAME_CSS is used wich has the value css.
However, it is not mandatory. You can provide a CSS file yourself.
https://documentation.concrete5.org/developers/designing-for-concret...
You can parse the less/sass yourself using task helpers like Grunt or Gulp. If you have installed Concrete via composer (see the download page) you can also use Laravel mix to do this.
<?php echo $html->css($view->getStylesheet('main.less')) ?>
The getStylesheet method calls the getStylesheetObject. In here the constant DIRNAME_CSS is used wich has the value css.
However, it is not mandatory. You can provide a CSS file yourself.
https://documentation.concrete5.org/developers/designing-for-concret...
You can parse the less/sass yourself using task helpers like Grunt or Gulp. If you have installed Concrete via composer (see the download page) you can also use Laravel mix to do this.
Finally - it's working. I think the problem was that I didn't deactivate and remove the theme after making my changes. Thank you for all your help! :D
The getThemeBlockClasses method should be placed in the page_theme.php file which is located in the theme folder.
Use the elemental theme as reference: concrete\themes\elemental\page_theme.php. It is also important that the theme is installed and activated.
Example from the elemental theme