updated contrib modules

This commit is contained in:
2019-07-09 12:22:32 +02:00
parent cc3b64a193
commit 438237e852
469 changed files with 17307 additions and 8396 deletions

View File

@@ -8,7 +8,7 @@ class context_condition_bookroot extends context_condition_node {
if ($this->condition_used() && !empty($node->book['bid'])) {
$type = db_select('node')
->fields('node', array('type'))
->condition('nid', $node->book['nid'])
->condition('nid', $node->book['bid'])
->execute()
->fetchField();
$book = new stdClass();

View File

@@ -14,7 +14,7 @@ class context_condition_menu extends context_condition {
foreach ($menus as $key => $name) {
$id = explode(':', $key);
if ($id[1] == '0') {
$root_menus[$id[0]] = check_plain($name);
$root_menus[$id[0]] = $name;
}
else {
$link = menu_link_load($id[1]);

View File

@@ -45,24 +45,28 @@ class context_condition_node_taxonomy extends context_condition_node {
$check_fields = array();
foreach ($instance_fields as $key => $field_info) {
if ($fields[$key]['type'] == 'taxonomy_term_reference') {
$check_fields[] = $key;
$check_fields[$key] = 'tid';
}
else if ($fields[$key]['type'] == 'entityreference' &&
$fields[$key]['settings']['target_type'] == 'taxonomy_term') {
$check_fields[$key] = 'target_id';
}
}
if ($this->condition_used() && !empty($check_fields)) {
foreach ($check_fields as $field) {
foreach ($check_fields as $field => $term_id_key) {
if ($terms = field_get_items('node', $node, $field)) {
foreach ($terms as $term) {
foreach ($this->get_contexts($term['tid']) as $context) {
foreach ($this->get_contexts($term[$term_id_key]) as $context) {
// Check the node form option.
if ($op === 'form') {
$options = $this->fetch_from_context($context, 'options');
if (!empty($options['node_form'])) {
$this->condition_met($context, $term['tid']);
$this->condition_met($context, $term[$term_id_key]);
}
}
else {
$this->condition_met($context, $term['tid']);
$this->condition_met($context, $term[$term_id_key]);
}
}
}

View File

@@ -16,7 +16,7 @@ class context_condition_query_string extends context_condition_path {
*/
function execute() {
if ($this->condition_used()) {
$current_query_string = $_SERVER["QUERY_STRING"];
$current_query_string = empty($_SERVER["QUERY_STRING"]) ? '' : $_SERVER["QUERY_STRING"];
foreach ($this->get_contexts() as $context) {
$query_strings = $this->fetch_from_context($context, 'values');
if ($this->match($current_query_string, $query_strings, TRUE)) {

View File

@@ -400,13 +400,17 @@ class context_reaction_block extends context_reaction {
unset($_context_blocks);
foreach ($context_blocks as $r => $blocks) {
//only render blocks in an active region
// Only render blocks in an active region.
if (array_key_exists($r, $active_regions)) {
$context_blocks[$r] = _block_render_blocks($blocks);
// Make blocks editable if allowed.
if ($this->is_editable_region($r)) {
foreach ($context_blocks[$r] as $key => $block) {
$editable = $this->is_editable_region($r);
foreach ($context_blocks[$r] as $key => $block) {
// Add the region property to each block.
$context_blocks[$r][$key]->region = $r;
// Make blocks editable if allowed.
if ($editable) {
$context_blocks[$r][$key] = $this->editable_block($block);
}
}
@@ -450,12 +454,9 @@ class context_reaction_block extends context_reaction {
*/
protected function max_block_weight() {
$blocks = $this->get_blocks();
$block_count = 0;
foreach ($blocks as $region => $block_list) {
$block_count += count($block_list);
}
// Add 2 to make sure there's space at either end of the block list
return round(($block_count + 2) / 2);
// Add 2 to make sure there's space at either end of the block list.
return round((count($blocks) + 2) / 2);
}
/**

View File

@@ -68,8 +68,8 @@ DrupalContextBlockForm = function(blockForm) {
// Hide enabled blocks from selector that are used
$('table.context-blockform-region tr').each(function() {
var bid = $(this).attr('id');
$('div.context-blockform-selector input[value='+bid+']').parents('div.form-item').eq(0).hide();
var bid = Drupal.checkPlain($(this).attr('id'));
$('div.context-blockform-selector input[value="'+bid+'"]').parents('div.form-item').eq(0).hide();
});
// Show blocks in selector that are unused
$('div.context-blockform-selector input').each(function() {
@@ -159,7 +159,7 @@ DrupalContextBlockForm = function(blockForm) {
$(this).removeAttr('checked');
});
if (weight_warn) {
alert(Drupal.t('Desired block weight exceeds available weight options, please check weights for blocks before saving'));
alert(Drupal.t('Desired block weight exceeds available weight options, please check weights for blocks before saving.'));
}
}
return false;
@@ -426,9 +426,8 @@ DrupalContextBlockEditor.prototype = {
$('.editing-context-label').remove();
var label = $('#context-editable-trigger-'+context+' .label').text();
label = Drupal.t('Now Editing: ') + label;
editor.parent().parent()
.prepend('<div class="editing-context-label">'+ label + '</div>');
label = Drupal.t('Now editing: @label', {'@label': label});
editor.parent().parent().prepend('<div class="editing-context-label">' + label + '</div>');
// First pass, enable sortables on all regions.
$(this.regions).each(function() {

View File

@@ -8,6 +8,7 @@ class context_reaction_breadcrumb extends context_reaction_menu {
* Overrides set_active_trail_from_link to set the breadcrumb instead of the menu path.
*/
function set_active_trail_from_link($item) {
$breadcrumb = array(l(t('Home'), '<front>'));
$result = db_select('menu_links')
->fields('menu_links', array('p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8'))
->condition('hidden', 0)

View File

@@ -22,19 +22,21 @@ class context_reaction_menu extends context_reaction {
$link = menu_link_load($mlid);
$identifier = $link['link_path'];
$root_menu = $menu_names[$menu_name];
while (isset($options[$root_menu][$identifier])) {
while (isset($options[$root_menu][$menu_name . ':' . $identifier])) {
$identifier .= "'";
}
$options[$root_menu][$menu_name . ':' . $identifier] = $title;
}
}
}
$menu_count = count($options, COUNT_RECURSIVE);
return array(
'#title' => $this->title,
'#description' => $this->description,
'#options' => $options,
'#type' => 'select',
'#multiple' => TRUE,
'#size' => $menu_count > 20 ? 20 : $menu_count,
'#default_value' => $this->fetch_from_context($context),
);
}

View File

@@ -17,7 +17,7 @@ class context_reaction_region extends context_reaction {
'#type' => 'fieldset',
'#title' => "Disable Regions in {$theme->name} Theme",
'#collapsible' => TRUE,
'#collapsed' => !array_reduce($default, create_function('$a, $b', 'return $a || $b;')),
'#collapsed' => !array_reduce($default, 'context_reaction_region::collapseRegion'),
);
$form[$theme->name]['disable'] = array(
'#type' => 'checkboxes',
@@ -29,6 +29,10 @@ class context_reaction_region extends context_reaction {
}
return $form;
}
function collapseRegion($a, $b) {
return $a || $b;
}
function execute(&$page) {
global $theme;

View File

@@ -14,7 +14,7 @@ class context_reaction_template_suggestions extends context_reaction {
return array(
'#title' => t('Template suggestions'),
'#type' => 'textarea',
'#description' => t('Enter template suggestions such as "page__front", one per line, in order of preference (using underscores instead of hyphens). For more information, please visit ') . l(t('Drupal 7 Template (Theme Hook) Suggestions'), 'http://drupal.org/node/1089656', array(array('target' => '_blank'), 'html' => TRUE,)) . '.',
'#description' => t('Enter template suggestions such as "page__front", one per line, in order of preference (using underscores instead of hyphens). For more information, please visit <a href="@template-suggestions">Drupal 7 Template (Theme Hook) Suggestions</a>.', array('@template-suggestions' => 'http://drupal.org/node/1089656')),
'#default_value' => is_string($default_value) ? $default_value : '',
);
}