Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3485117
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3485117
Commits
0a301aa8
Commit
0a301aa8
authored
10 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2384583
by jibran: Remove taxonomy_select_nodes function
parent
ea1dd457
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/taxonomy/taxonomy.module
+5
-61
5 additions, 61 deletions
core/modules/taxonomy/taxonomy.module
with
5 additions
and
61 deletions
core/modules/taxonomy/taxonomy.module
+
5
−
61
View file @
0a301aa8
...
...
@@ -134,62 +134,6 @@ function taxonomy_page_attachments_alter(array &$page) {
}
}
/**
* Return nodes attached to a term across all fields.
*
* This function requires taxonomy module to be maintaining its own tables,
* and will return an empty array if it is not. If using other field storage
* methods alternatives methods for listing terms will need to be used.
*
* @param $tid
* The term ID.
* @param $pager
* Boolean to indicate whether a pager should be used.
* @param $limit
* Integer. The maximum number of nodes to find.
* Set to FALSE for no limit.
* @param $order
* An array of fields and directions.
*
* @return
* An array of nids matching the query.
*/
function
taxonomy_select_nodes
(
$tid
,
$pager
=
TRUE
,
$limit
=
FALSE
,
$order
=
array
(
't.sticky'
=>
'DESC'
,
't.created'
=>
'DESC'
))
{
if
(
!
\Drupal
::
config
(
'taxonomy.settings'
)
->
get
(
'maintain_index_table'
))
{
return
array
();
}
$query
=
db_select
(
'taxonomy_index'
,
't'
);
$query
->
addTag
(
'node_access'
);
$query
->
addMetaData
(
'base_table'
,
'taxonomy_index'
);
$query
->
condition
(
'tid'
,
$tid
);
$query
->
condition
(
'status'
,
NODE_PUBLISHED
);
if
(
$pager
)
{
$count_query
=
clone
$query
;
$count_query
->
addExpression
(
'COUNT(t.nid)'
);
$query
=
$query
->
extend
(
'Drupal\Core\Database\Query\PagerSelectExtender'
);
if
(
$limit
!==
FALSE
)
{
$query
=
$query
->
limit
(
$limit
);
}
$query
->
setCountQuery
(
$count_query
);
}
else
{
if
(
$limit
!==
FALSE
)
{
$query
->
range
(
0
,
$limit
);
}
}
$query
->
addField
(
't'
,
'nid'
);
$query
->
addField
(
't'
,
'tid'
);
foreach
(
$order
as
$field
=>
$direction
)
{
$query
->
orderBy
(
$field
,
$direction
);
// ORDER BY fields need to be loaded too, assume they are in the form
// table_alias.name
list
(
$table_alias
,
$name
)
=
explode
(
'.'
,
$field
);
$query
->
addField
(
$table_alias
,
$name
);
}
return
$query
->
execute
()
->
fetchCol
();
}
/**
* Implements hook_theme().
*/
...
...
@@ -634,11 +578,11 @@ function taxonomy_autocomplete_validate($element, FormStateInterface $form_state
* sorted by creation date. To avoid slow queries due to joining across
* multiple node and field tables with various conditions and order by criteria,
* we maintain a denormalized table with all relationships between terms,
* published nodes and common sort criteria such as sticky and created.
*
This is used as a lookup table by taxonomy_select_nodes(). When using other
*
field storage engines or alternative methods of
denormalizing this data
*
you should set the
taxonomy.settings:maintain_index_table to '0' to avoid
*
unnecessary writes in
SQL.
* published nodes and common sort criteria such as
status,
sticky and created.
*
When using other field storage engines or alternative methods of
* denormalizing this data
you should set the
* taxonomy.settings:maintain_index_table to '0' to avoid
unnecessary writes in
* SQL.
*/
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment