Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem
We need a feature that allowv us to add a new colorbox styles using a hook.
Solution
Use drupal_alter passing $colorbox_style by reference: drupal_alter('colorbox_styles', $colorbox_styles)
This solution allow thirt party modules to use a hook_colorbox_styles_alter to modify the array that add styles on administrative section.
Example (how to)
1 - In your module, you implement the hook_colorbox_styles_alter.
Add a new item on array.
function MYMODULE_colorbox_styles_alter(&$colorbox_styles){
$colorbox_styles['/path/to/folder/new/style'] = 'New Style';
}
2 - In your folder style you must create a colorbox.css file.
3 - In colorbox settings you will see a new style
Comment | File | Size | Author |
---|---|---|---|
#3 | colorbox-2778419-1.patch | 462 bytes | cesarromagnolo |
Captura de Tela 2016-08-03 às 11.03.59.png | 52.54 KB | cesarromagnolo |
Comments
Comment #2
cesarromagnolo CreditAttribution: cesarromagnolo commentedComment #3
cesarromagnolo CreditAttribution: cesarromagnolo commentedComment #4
Neslee Canil Pinto