Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
225
Merge Requests
225
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
0a301aa8
Commit
0a301aa8
authored
Jan 20, 2015
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2384583
by jibran: Remove taxonomy_select_nodes function
parent
ea1dd457
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
61 deletions
+5
-61
core/modules/taxonomy/taxonomy.module
core/modules/taxonomy/taxonomy.module
+5
-61
No files found.
core/modules/taxonomy/taxonomy.module
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 st
atus, st
icky 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.
*/
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment