Pasar al contenido principal
x

Acerca de

Block Class allows users to add classes to any block through the block's configuration interface. Hooray for more powerful block theming!

Usage

To add a class to a block, simply visit that block's configuration page at Administration » Structure » Block Layout and click on Configure of the desired block.
The max-length by default is 255, after the 2.0.x version there is a Global Settings Page and you can modify if you need at: Configuration » Content authoring » Block Class
You can also add attributes in the multiple attributes field available in the block list as well. You can set the key and the value of the attributes that you want.
Remember that you can't use id attribute because is the Drupal's default, and you can't use attribute class because there is a specific field to use in class.

Global Configuration

Inside of global settings there are some possibilities to be used:
  • General
    • Enable auto-complete: Enabling this option when you are typing will appear an auto-complete for you to select the other classes that you have.
    • Enable special chars: By default block class will have this option unchecked to block special chars by default. But if you need for any reason you can check this option and it will be accepted.
    • The "Default Case" is a field to select a standard of your classes. So if you select "Uppercase and Lowercase" but cases will be accepted. If you select "Uppercase" all classes will be added using uppercase and if you select "Lowercase" all classes added will be added using lowercase. Attention, if you change to only lowercase or only uppercase when save the block all block classes will be updated.
  • Clase
    • Qty of classes per block: You can select this number to use in the multiple items. By default is 10 but you can modify if necessary
    • Field Type: By default the block class is using the field type as a "texfield", with that configuration you can select textarea as well, it's recommended if you have many classes per block
    • The max-length by default is 255, after the 2.0.x version there is a Global Settings Page and you can modify if you need at: /admin/config/content/block-class/settings or Configuration » Content authoring » Block Class
    • Weight: Set the weight to organize better the field items in the block settings
  • Atributos
    • Enable attributes: Mark this option to be able to use attributes.
    • Qty of attributes per block: On this field you can define how many attribute field will be implemented per block. By default is 10 but you can increase and decrease if you want.
    • Maxlengh: In the attributes field group you can insert the maxlengh, by default there is no limit for attributes but you can insert if you want.
    • Weight: Set the weight to organize better the field items in the block settings
  • ID
    • Enable id replacement: Mark this option to be able to use ID.
    • Maxlengh: In the ID field group you can insert the maxlengh, by default there is no limit for ID but you can insert if you want.
    • Weight: Set the weight to organize better the field items in the block settings
  • Avanzado
    • You can use the filter "Filter to HTML Clean CSS Identifier" to put a list of chars to be replaced by default in the class Html::cleanCssIdentifier

Block List

You're able to see that at admin/config/content/block-class/list , on this list you're able to see all blocks that have block class added, and on this table you also can edit easily your block classes and if you need you can remove the block class using this page as well

Bulk Operations

There is a Bulk Operation to update classes automatically to help. To do this, you can go to Administration » Configuration » Content authoring » Block Class » Bulk Operations and there you can select some options:
Insert classes: With that option you can insert a class by default in all blocks that you have
Insert Attributes: With this option you can insert with a bulk operation attributes to all blocks that you have
Convert all attributes to uppercase: With this operation you can update all attributes that you have to use uppercase.
Convert all attributes to lowercase: With this operation you can update all attributes that you have to use lowercase.
Convert all block classes to uppercase: With this operation you can convert all block classes that you have to use uppercase.
Convert all block classes to lowercase: With this operation you can convert all block classes that you have to use lowercase.
Update class: With that option you can insert a current class that you have in the field "Current class" and in the other field "New class" you can insert the new class that you want to use. After this you'll be redirected to another page to review that and update all classes.
Delete all block classes: With this option, the bulk operation will remove all block classes on blocks. After this form you'll be redirected to another page to confirm that operation
Delete all attributes: With this option the bulk operation will remove all attributes on blocks. After this form you'll be redirected to another page to confirm that operation.
Insert Attributes: With this option you can insert with a bulk operation attributes to all blocks that you have
Delete all block classes: With this option, the bulk operation will remove all block classes on blocks. After this form you'll be redirected to another page to confirm that operation

Block Class Documentation

To see more information feel free to see our documentation at Drupal » Contributed Projects » Block Class