Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
drupal.org
page_title
Commits
ff38c2e7
Commit
ff38c2e7
authored
Aug 15, 2009
by
Nicholas Thompson
Browse files
Work on porting Page Title to Drupal 7
parent
679d592c
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
page_title-admin-settings-form.tpl.php
View file @
ff38c2e7
...
...
@@ -5,7 +5,7 @@ foreach (element_children($form['title']) as $key) {
$row
=
array
();
$row
[]
=
drupal_render
(
$form
[
'title'
][
$key
]);
$row
[]
=
drupal_render
(
$form
[
'pattern'
][
$key
]);
$rows
[]
=
$row
;
}
...
...
page_title.info
View file @
ff38c2e7
; $Id$
name = Page Title
description = "Enhanced control over the page title (in the <head> tag)."
dependencies[] = token
core = 6.x
\ No newline at end of file
core = 7.x
files[] = page_title.module
files[] = page_title.admin.inc
page_title.install
View file @
ff38c2e7
...
...
@@ -12,24 +12,82 @@ function page_title_install() {
function
page_title_schema
()
{
$schema
[
'page_title'
]
=
array
(
'fields'
=>
array
(
'nid'
=>
array
(
'type'
=>
'int'
,
'unsigned'
=>
TRUE
,
'not null'
=>
TRUE
,
'default'
=>
0
),
'type'
=>
array
(
'type'
=>
'varchar'
,
'length'
=>
15
,
'not null'
=>
TRUE
,
'default'
=>
'node'
),
'id'
=>
array
(
'type'
=>
'int'
,
'unsigned'
=>
TRUE
,
'not null'
=>
TRUE
,
'default'
=>
0
),
'page_title'
=>
array
(
'type'
=>
'varchar'
,
'length'
=>
255
,
'not null'
=>
TRUE
,
'default'
=>
''
)
),
'primary key'
=>
array
(
'
n
id'
),
'primary key'
=>
array
(
'
type'
,
'
id'
),
);
return
$schema
;
}
/**
* Implementation of hook_update_n().
*/
function
page_title_update_6200
()
{
$ret
=
array
();
if
(
db_column_exists
(
'page_title'
,
'id'
))
{
return
$ret
;
}
db_create_table
(
$ret
,
'page_title_temp'
,
array
(
'fields'
=>
array
(
'type'
=>
array
(
'type'
=>
'varchar'
,
'length'
=>
15
,
'not null'
=>
TRUE
,
'default'
=>
'node'
),
'id'
=>
array
(
'type'
=>
'int'
,
'unsigned'
=>
TRUE
,
'not null'
=>
TRUE
,
'default'
=>
0
),
'page_title'
=>
array
(
'type'
=>
'varchar'
,
'length'
=>
255
,
'not null'
=>
TRUE
,
'default'
=>
''
)
),
'primary key'
=>
array
(
'type'
,
'id'
),
));
$ret
[]
=
update_sql
(
'INSERT INTO {page_title_temp} (id, page_title) SELECT nid, page_title FROM {page_title}'
);
db_rename_table
(
$ret
,
'page_title'
,
'page_title_old'
);
db_rename_table
(
$ret
,
'page_title_temp'
,
'page_title'
);
$display_settings
=
variable_get
(
'page_title_display'
,
array
());
foreach
(
$display_settings
as
$type
)
{
if
(
$type
)
{
variable_set
(
'page_title_type_'
.
$type
.
'_showfield'
,
1
);
}
}
variable_del
(
'page_title_display'
);
return
$ret
;
}
/**
* Implementation of hook_uninstall().
*/
function
page_title_uninstall
()
{
db_query
(
'DROP TABLE {page_title}'
);
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_type_get_names
();
foreach
(
$types
as
$type
=>
$name
)
{
variable_del
(
"page_title_type_
{
$type
}
"
);
variable_del
(
"page_title_type_
{
$type
}
_showfield"
);
}
}
\ No newline at end of file
// Clear the vocab specific variables
if
(
module_exists
(
'taxonomy'
))
{
$vocabs
=
taxonomy_get_vocabularies
();
foreach
(
$vocabs
as
$vid
=>
$vocab
)
{
variable_del
(
"page_title_vocab_
{
$vid
}
"
);
variable_del
(
"page_title_vocab_
{
$vid
}
_showfield"
);
}
}
}
page_title.module
View file @
ff38c2e7
This diff is collapsed.
Click to expand it.
template.php
deleted
100755 → 0
View file @
679d592c
<?php
function
_phptemplate_variables
(
$hook
,
$vars
)
{
$vars
=
array
();
if
(
$hook
==
'page'
)
{
if
(
module_exists
(
'page_title'
))
{
$vars
[
'head_title'
]
=
page_title_page_get_title
();
}
}
return
$vars
;
}
Write
Preview
Supports
Markdown
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