Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
V
views_natural_sort
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
1
Merge Requests
1
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
views_natural_sort
Commits
8290784f
Commit
8290784f
authored
Nov 28, 2012
by
generalredneck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[
#1853554
] Added functionality to delete a node title index on node delete.
parent
fe5a7557
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
0 deletions
+25
-0
views_natural_sort.module
views_natural_sort.module
+25
-0
No files found.
views_natural_sort.module
View file @
8290784f
...
@@ -84,11 +84,21 @@ function views_natural_sort_node_update($node) {
...
@@ -84,11 +84,21 @@ function views_natural_sort_node_update($node) {
_views_natural_sort_store_node
(
$node
);
_views_natural_sort_store_node
(
$node
);
}
}
/**
* Implementation of hook_node_delete().
*
* This keep sour natural sort index clean.
*/
function
views_natural_sort_node_delete
(
$node
)
{
_views_natural_sort_remove_node
(
$node
);
}
/**
/**
* Helper function for writing node data to our sort index.
* Helper function for writing node data to our sort index.
*
*
* @param $node
* @param $node
* A drupal node object containing at least a nid and title.
* A drupal node object containing at least a nid and title.
*
* @return int
* @return int
* MergeQuery::STATUS_UPDATE or MergeQuery::STATUS_INSERT
* MergeQuery::STATUS_UPDATE or MergeQuery::STATUS_INSERT
*/
*/
...
@@ -106,6 +116,21 @@ function _views_natural_sort_store_node($node) {
...
@@ -106,6 +116,21 @@ function _views_natural_sort_store_node($node) {
->
execute
();
->
execute
();
}
}
/**
* Helper function for removing node data from our sort index.
*
* @param $node
* A drupal node object containing at least a nid.
*
* @return int
* The number of rows deleted.
*/
function
_views_natural_sort_remove_node
(
$node
)
{
return
db_delete
(
'views_natural_sort'
)
->
condition
(
'nid'
,
$node
->
nid
)
->
execute
();
}
/**
/**
* Encodes a string into an ascii-sortable such:
* Encodes a string into an ascii-sortable such:
* - Leading articles in common languages are ingored: The A An El La Le Il
* - Leading articles in common languages are ingored: The A An El La Le Il
...
...
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