upadated colorbox andd prod_check
This commit is contained in:
@@ -89,7 +89,7 @@ Make any CSS adjustments to your "colorbox_mycolorbox.css" file.
|
||||
Load images from custom links in a Colorbox:
|
||||
--------------------------------------------
|
||||
|
||||
Add the class "colorbox" to the link and point the src to the image
|
||||
Add the class "colorbox" to the link and point its href attribute to the image
|
||||
you want to display in the Colorbox.
|
||||
|
||||
|
||||
|
@@ -27,3 +27,18 @@ function hook_colorbox_settings_alter(&$settings, &$style) {
|
||||
$style = 'mystyle';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows to override activation of Colobox for the current URL.
|
||||
*
|
||||
* @param $active
|
||||
* A boolean indicating whether colorbox should be active for the current
|
||||
* URL or not.
|
||||
*/
|
||||
function hook_colorbox_active_alter(&$active) {
|
||||
$path = drupal_get_path_alias($_GET['q']);
|
||||
if (drupal_match_path($path, 'admin/config/colorbox_test')) {
|
||||
// Enable colorbox for this URL.
|
||||
$active = TRUE;
|
||||
}
|
||||
}
|
||||
|
@@ -1,14 +1,14 @@
|
||||
name = Colorbox
|
||||
description = A light-weight, customizable lightbox plugin for jQuery 1.4.3+.
|
||||
dependencies[] = libraries (2.x)
|
||||
dependencies[] = libraries (>=2.x)
|
||||
core = 7.x
|
||||
configure = admin/config/media/colorbox
|
||||
|
||||
files[] = views/colorbox_handler_field_colorbox.inc
|
||||
|
||||
; Information added by Drupal.org packaging script on 2014-09-12
|
||||
version = "7.x-2.8"
|
||||
; Information added by Drupal.org packaging script on 2015-10-01
|
||||
version = "7.x-2.10"
|
||||
core = "7.x"
|
||||
project = "colorbox"
|
||||
datestamp = "1410514129"
|
||||
datestamp = "1443691449"
|
||||
|
||||
|
@@ -152,6 +152,9 @@ function _colorbox_active() {
|
||||
}
|
||||
$page_match = variable_get('colorbox_visibility', 0) == 0 ? !$page_match : $page_match;
|
||||
|
||||
// Allow other modules to change the state of colorbox for the current URL.
|
||||
drupal_alter('colorbox_active', $page_match);
|
||||
|
||||
return $page_match;
|
||||
}
|
||||
|
||||
|
@@ -17,6 +17,7 @@
|
||||
* @ingroup themeable
|
||||
*/
|
||||
function theme_colorbox_image_formatter($variables) {
|
||||
static $gallery_token = NULL;
|
||||
$item = $variables['item'];
|
||||
$entity_type = $variables['entity_type'];
|
||||
$entity = $variables['entity'];
|
||||
@@ -123,6 +124,16 @@ function theme_colorbox_image_formatter($variables) {
|
||||
$gallery_id = '';
|
||||
}
|
||||
|
||||
// If gallery id is not empty add unique per-request token to avoid images being added manually to galleries.
|
||||
if (!empty($gallery_id)) {
|
||||
// Check if gallery token has alrady been set, we need to reuse the token for the whole request.
|
||||
if (is_null($gallery_token)) {
|
||||
// We use a short token since randomness is not critical.
|
||||
$gallery_token = drupal_random_key(8);
|
||||
}
|
||||
$gallery_id = $gallery_id . '-' . $gallery_token;
|
||||
}
|
||||
|
||||
if ($style_name = $settings['colorbox_image_style']) {
|
||||
$path = image_style_url($style_name, $image['path']);
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Drupal.behaviors.initColorbox = {
|
||||
attach: function (context, settings) {
|
||||
if (!$.isFunction($.colorbox)) {
|
||||
if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Drupal.behaviors.initColorboxInline = {
|
||||
attach: function (context, settings) {
|
||||
if (!$.isFunction($.colorbox)) {
|
||||
if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
|
||||
return;
|
||||
}
|
||||
$.urlParam = function(name, url){
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Drupal.behaviors.initColorboxLoad = {
|
||||
attach: function (context, settings) {
|
||||
if (!$.isFunction($.colorbox)) {
|
||||
if (!$.isFunction($.colorbox) || typeof settings.colorbox === 'undefined') {
|
||||
return;
|
||||
}
|
||||
$.urlParams = function (url) {
|
||||
|
@@ -162,10 +162,15 @@ If you would like to have the characters %5B and %5D please use the html entity
|
||||
$tokens = $this->get_render_tokens($this->options['alter']);
|
||||
$popup = filter_xss_admin($this->options['popup']);
|
||||
$caption = filter_xss_admin($this->options['caption']);
|
||||
$gallery = drupal_html_class($this->options['custom_gid']);
|
||||
$gallery = filter_xss_admin($this->options['custom_gid']);
|
||||
$popup = strtr($popup, $tokens);
|
||||
$caption = strtr($caption, $tokens);
|
||||
$gallery = strtr($gallery, $tokens);
|
||||
$gallery = drupal_html_class(strtr($gallery, $tokens));
|
||||
|
||||
// Return nothing if popup is empty.
|
||||
if (empty($popup)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$width = $this->options['width'] ? $this->options['width'] : '';
|
||||
$height = $this->options['height'] ? $this->options['height'] : '';
|
||||
|
Reference in New Issue
Block a user