Closed (fixed)
Project:
Colorbox
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Apr 2020 at 21:08 UTC
Updated:
17 Feb 2021 at 18:44 UTC
Jump to comment: Most recent
Version 7.x-2.15 includes example colorbox styles in the following code in colorbox.admin.inc:
$form['colorbox_custom_settings']['colorbox_style'] = array(
'#type' => 'select',
'#title' => t('Style'),
'#options' => $colorbox_styles,
'#default_value' => variable_get('colorbox_style', 'default'),
'#description' => t('Select the style to use for the Colorbox. The example styles are the ones that come with the Colorbox plugin. Select "None" if you have added Colorbox styles to your theme. <br> <strong>Examples</strong>: <ul><li><a href="/sites/all/modules/colorbox/images/admin/example_default.png" target="blank">Default</a></li><li><a href="/sites/all/modules/colorbox/images/admin/example_plain.png" target="blank">Plain</a></li><li><a href="/sites/all/modules/colorbox/images/admin/example_stockholm_syndrome.png" target="blank">Stockholm Syndrome</a></li><li><a href="/sites/all/modules/colorbox/images/admin/colorbox_example_1.png" target="blank">Example 1</a></li><li><a href="/sites/all/modules/colorbox/images/admin/colorbox_example_2.png" target="blank">Example 2</a></li><li><a href="/sites/all/modules/colorbox/images/admin/colorbox_example_3.png" target="blank">Example 3</a></li><li><a href="/sites/all/modules/colorbox/images/admin/colorbox_example_4.png" target="blank">Example 4</a></li><li><a href="/sites/all/modules/colorbox/images/admin/colorbox_example_5.png" target="blank">Example 5</a></li><li><a href="/sites/all/modules/colorbox/images/admin/example_none.png" target="blank">None</a></li></ul>'),
);
Drupal modules should never assume the location of module directories. For example, many sites use a multisite setup or place modules in a subdirectory such as /sites/all/modules/contrib. In those types of environments, the #description will always return a "404 Not Found".
The proper approach is to always use the drupal_get_path function: https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_...
drupal_get_path('module', 'colorbox')
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
sgdev commentedComment #3
neslee canil pintoComment #4
sgdev commentedWhy is this "works as designed"? It's a bug that needs to be fixed.
Comment #11
shashikant_chauhan commentedYes, @ron_s, the module location should not be assumed.
I have created the fork for this issue, it took time and a few trials and errors as I am using the issue form and merge request using GitLab for first time.
Also, it will not work with the website having like "www.example.com/website1".
Fixed this one as well using $base_url.
Regards,
Shashikant
Comment #12
shashikant_chauhan commentedComment #13
solideogloria commentedI agree this needs to be fixed. Drupal's configuration guidelines itself has the option of using the contrib folder.
Comment #14
neslee canil pintoMerged to the dev branch.