Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
page_title
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
page_title
Commits
7e8f799b
Commit
7e8f799b
authored
15 years ago
by
Nicholas Thompson
Browse files
Options
Downloads
Patches
Plain Diff
Some code for variable tidy-up on uninstall and setting submission
parent
0f5190ab
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
page_title.install
+20
-2
20 additions, 2 deletions
page_title.install
page_title.module
+14
-4
14 additions, 4 deletions
page_title.module
with
34 additions
and
6 deletions
page_title.install
+
20
−
2
View file @
7e8f799b
...
...
@@ -73,9 +73,27 @@ function page_title_update_6200() {
*/
function
page_title_uninstall
()
{
drupal_uninstall_schema
(
'page_title'
);
// Clear variables
variable_del
(
'page_title_default'
);
variable_del
(
'page_title_individual'
);
variable_del
(
'page_title_front'
);
foreach
(
node_get_types
(
'names'
)
AS
$type
=>
$name
)
{
variable_del
(
"page_title_display_
$type
"
);
variable_del
(
'page_title_blog'
);
variable_del
(
'page_title_user'
);
variable_del
(
'page_title_user_showfield'
);
variable_del
(
'page_title_pager_pattern'
);
// Clear the node specific variables
$types
=
node_get_types
(
'names'
);
foreach
(
$types
as
$type
=>
$name
)
{
variable_del
(
"page_title_type_
{
$type
}
"
);
variable_del
(
"page_title_type_
{
$type
}
_showfield"
);
}
// Clear the vocab specific variables
$vocabs
=
taxonomy_get_vocabularies
();
foreach
(
$vocabs
as
$vid
=>
$vocab
)
{
variable_del
(
"page_title_vocab_
{
$vid
}
"
);
variable_del
(
"page_title_vocab_
{
$vid
}
_showfield"
);
}
}
This diff is collapsed.
Click to expand it.
page_title.module
+
14
−
4
View file @
7e8f799b
...
...
@@ -89,7 +89,8 @@ function page_title_theme() {
* Updates settings after a node type change.
*/
function
page_title_node_type
(
$op
,
$info
)
{
if
(
$op
==
'update'
&&
!
empty
(
$info
->
old_type
)
and
$info
->
type
!=
$info
->
old_type
)
{
// Handle a content type rename
if
(
$op
==
'update'
&&
!
empty
(
$info
->
old_type
)
&&
$info
->
type
!=
$info
->
old_type
)
{
// Load the old node type settings.
$temp
=
variable_get
(
'page_title_type_'
.
$info
->
old_type
,
''
);
...
...
@@ -99,15 +100,21 @@ function page_title_node_type($op, $info) {
}
// Delete the old setting
variable_del
(
'page_title_type_'
.
$info
-
old_type
);
variable_del
(
'page_title_type_'
.
$info
->
old_type
);
// Essentially, do the same as above but with the _showfield suffix for the node type
$temp
=
variable_get
(
'page_title_type_'
.
$info
->
old_type
.
'_showfield'
,
0
);
if
(
$temp
)
{
variable_set
(
'page_title_type_'
.
$info
->
type
.
'_showfield'
,
$temp
);
}
variable_del
(
'page_title_type_'
.
$info
-
old_type
.
'_showfield'
);
variable_del
(
'page_title_type_'
.
$info
->
old_type
.
'_showfield'
);
}
// If deleted, remove the variables
if
(
$op
==
'delete'
)
{
variable_del
(
'page_title_type_'
.
$info
->
type
);
variable_del
(
'page_title_type_'
.
$info
->
type
.
'_showfield'
);
}
}
...
...
@@ -201,6 +208,9 @@ function page_title_node_type_form_submit($form, &$form_state) {
$show_field
=
$form_state
[
'values'
][
'page_title'
][
'show_field'
][
'show_field'
]
?
1
:
0
;
variable_set
(
'page_title_type_'
.
$form_state
[
'values'
][
'type'
]
.
'_showfield'
,
$show_field
);
variable_set
(
'page_title_type_'
.
$form_state
[
'values'
][
'type'
],
$form_state
[
'values'
][
'page_title'
][
'pattern'
]);
// For some reason the node module adds the fieldset as a separate entry in the variables table... we dont want this!
variable_del
(
'page_title_'
.
$form_state
[
'values'
][
'type'
]);
}
...
...
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