summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoloc2012-11-24 19:42:39 (GMT)
committer Moloc2012-11-24 19:42:39 (GMT)
commit36ce8c697da31d6b91e9852f178ac4c07f5cb1b4 (patch)
tree26772392c721920da2d80028a70ccf169ccd9911
parent2fcf98ed40478bc6f392683bd2258b1f20e98d49 (diff)
Issue #1701690 by Moloc: Fixed reordering galleries, which use a different html-id
-rw-r--r--media_gallery.pages.inc11
1 files changed, 10 insertions, 1 deletions
diff --git a/media_gallery.pages.inc b/media_gallery.pages.inc
index 09b3271..3ac50b8 100644
--- a/media_gallery.pages.inc
+++ b/media_gallery.pages.inc
@@ -164,7 +164,16 @@ function media_gallery_ajax_sort($type, $item) {
$id_prefix = '';
switch ($type) {
case 'collection':
- $id_prefix = 'node-';
+ // There are some themes, which set a specific html-prefix for the node
+ // id. Parse the id to be compatible with all themes.
+ // @see drupal_html_id()
+ $search = empty($order[0]) ? '' : $order[0];
+ if (preg_match('/^([A-Za-z0-9\-_]+?-)[0-9]+(--[0-9]+)?$/', $search, $match)) {
+ $id_prefix = $match[1];
+ }
+ else {
+ $id_prefix = 'node-';
+ }
$order = _media_gallery_sanitize_ids($id_prefix, $order);
$result = media_gallery_reorder_collection($item, $order);
break;