Skip to content

Commit

Permalink
#6612 change to taxonomy module in drupal core update
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Davis committed Jan 9, 2023
1 parent ac962ce commit 98150ef
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions sites/all/modules/custom/leftandright/taxonomy.module.inc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function taxonomy_select_nodes($tid, $pager = TRUE, $limit = FALSE, $order = arr
}
$query = db_select('taxonomy_index', 't');
$query->addTag('node_access');
$query->condition('tid', $tid);
$query->condition('t.tid', $tid);
if ($pager) {
$count_query = clone $query;
$count_query->addExpression('COUNT(t.nid)');
Expand Down Expand Up @@ -1274,7 +1274,7 @@ class TaxonomyTermController extends DrupalDefaultEntityController {
// LOWER() and drupal_strtolower() may return different results.
foreach ($terms as $term) {
$term_values = (array) $term;
if (isset($conditions['name']) && drupal_strtolower($conditions['name'] != drupal_strtolower($term_values['name']))) {
if (isset($conditions['name']) && drupal_strtolower($conditions['name']) != drupal_strtolower($term_values['name'])) {
unset($terms[$term->tid]);
}
}
Expand Down Expand Up @@ -1513,7 +1513,7 @@ function taxonomy_field_validate($entity_type, $entity, $field, $instance, $lang
// Build an array of existing term IDs so they can be loaded with
// taxonomy_term_load_multiple();
foreach ($items as $delta => $item) {
if (!empty($item['tid']) && $item['tid'] != 'autocreate') {
if (!empty($item['tid']) && $item['tid'] !== 'autocreate') {
$tids[] = $item['tid'];
}
}
Expand All @@ -1524,7 +1524,7 @@ function taxonomy_field_validate($entity_type, $entity, $field, $instance, $lang
// allowed values for this field.
foreach ($items as $delta => $item) {
$validate = TRUE;
if (!empty($item['tid']) && $item['tid'] != 'autocreate') {
if (!empty($item['tid']) && $item['tid'] !== 'autocreate') {
$validate = FALSE;
foreach ($field['settings']['allowed_values'] as $settings) {
// If no parent is specified, check if the term is in the vocabulary.
Expand Down Expand Up @@ -1600,7 +1600,7 @@ function taxonomy_field_formatter_view($entity_type, $entity, $field, $instance,
switch ($display['type']) {
case 'taxonomy_term_reference_link':
foreach ($items as $delta => $item) {
if ($item['tid'] == 'autocreate') {
if ($item['tid'] === 'autocreate') {
$element[$delta] = array(
'#markup' => check_plain($item['name']),
);
Expand All @@ -1620,7 +1620,7 @@ function taxonomy_field_formatter_view($entity_type, $entity, $field, $instance,

case 'taxonomy_term_reference_plain':
foreach ($items as $delta => $item) {
$name = ($item['tid'] != 'autocreate' ? $item['taxonomy_term']->name : $item['name']);
$name = ($item['tid'] !== 'autocreate' ? $item['taxonomy_term']->name : $item['name']);
$element[$delta] = array(
'#markup' => check_plain($name),
);
Expand All @@ -1631,9 +1631,9 @@ function taxonomy_field_formatter_view($entity_type, $entity, $field, $instance,
foreach ($items as $delta => $item) {
$entity->rss_elements[] = array(
'key' => 'category',
'value' => $item['tid'] != 'autocreate' ? $item['taxonomy_term']->name : $item['name'],
'value' => $item['tid'] !== 'autocreate' ? $item['taxonomy_term']->name : $item['name'],
'attributes' => array(
'domain' => $item['tid'] != 'autocreate' ? url('taxonomy/term/' . $item['tid'], array('absolute' => TRUE)) : '',
'domain' => $item['tid'] !== 'autocreate' ? url('taxonomy/term/' . $item['tid'], array('absolute' => TRUE)) : '',
),
);
}
Expand Down Expand Up @@ -1678,7 +1678,7 @@ function taxonomy_field_formatter_prepare_view($entity_type, $entities, $field,
foreach ($entities as $id => $entity) {
foreach ($items[$id] as $delta => $item) {
// Force the array key to prevent duplicates.
if ($item['tid'] != 'autocreate') {
if ($item['tid'] !== 'autocreate') {
$tids[$item['tid']] = $item['tid'];
}
}
Expand All @@ -1697,7 +1697,7 @@ function taxonomy_field_formatter_prepare_view($entity_type, $entities, $field,
$items[$id][$delta]['taxonomy_term'] = $terms[$item['tid']];
}
// Terms to be created are not in $terms, but are still legitimate.
elseif ($item['tid'] == 'autocreate') {
elseif ($item['tid'] === 'autocreate') {
// Leave the item in place.
}
// Otherwise, unset the instance value, since the term does not exist.
Expand Down Expand Up @@ -1901,7 +1901,7 @@ function taxonomy_rdf_mapping() {
*/
function taxonomy_field_presave($entity_type, $entity, $field, $instance, $langcode, &$items) {
foreach ($items as $delta => $item) {
if ($item['tid'] == 'autocreate') {
if ($item['tid'] === 'autocreate') {
$term = (object) $item;
unset($term->tid);
taxonomy_term_save($term);
Expand Down Expand Up @@ -2061,3 +2061,12 @@ function taxonomy_entity_query_alter($query) {
unset($conditions['bundle']);
}
}

/**
* Implements hook_file_download_access().
*/
function taxonomy_file_download_access($field, $entity_type, $entity) {
if ($entity_type == 'taxonomy_term') {
return user_access('access content');
}
}

0 comments on commit 98150ef

Please sign in to comment.