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')
Issue fork colorbox-3127345
Show commands
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:
- 3127345-fix-404-issue changes, plain diff MR !3
- 3127345-fix changes, plain diff MR !2
- 3127345-do-not-assume changes, plain diff MR !1
Comments
Comment #2
ron_s CreditAttribution: ron_s commentedComment #3
Neslee Canil PintoComment #4
ron_s CreditAttribution: ron_s commentedWhy is this "works as designed"? It's a bug that needs to be fixed.
Comment #11
shashikant_chauhan CreditAttribution: shashikant_chauhan as a volunteer 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 CreditAttribution: shashikant_chauhan as a volunteer commentedComment #13
solideogloria CreditAttribution: 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.