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
b20a1d71
Commit
b20a1d71
authored
Jan 06, 2012
by
Nicholas Thompson
Browse files
Porting the Ubercart integration from the D6 branch.
parent
e9ab0ba6
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/uc_catalog.page_title.inc
0 → 100644
View file @
b20a1d71
<?php
/**
* @file
* Ubercart Catalog implementations of the page title hooks
*/
/**
* Ubercart Catalog pages are on both:
* /catalog
* /catalog/[tid]
*
* This means we need to make sure arg(1) in the menu item is a valid term.
*/
/**
* Implementation of hook_page_title_alter().
*/
function
uc_catalog_page_title_alter
(
&
$title
)
{
$menu_item
=
menu_get_item
();
// If we're looking at a UC Catalog term page, get the term title
if
(
!
strncmp
(
$menu_item
[
'path'
],
'catalog'
,
7
)
&&
isset
(
$menu_item
[
'page_arguments'
][
0
])
&&
(
$term
=
taxonomy_term_load
(
$menu_item
[
'page_arguments'
][
0
]))
&&
variable_get
(
'page_title_vocab_'
.
$term
->
vocabulary_machine_name
.
'_showfield'
,
0
)
&&
(
$term_title
=
page_title_load_title
(
$term
->
tid
,
'term'
))
)
{
$title
=
$term_title
;
}
dvm
(
$term
);
}
/**
* Implementation of hook_page_title_pattern_alter().
*/
function
uc_catalog_page_title_pattern_alter
(
&
$pattern
,
&
$types
)
{
$menu_item
=
menu_get_item
();
// Ubercart Catalog Term Page
if
(
!
strncmp
(
$menu_item
[
'path'
],
'catalog'
,
7
)
&&
isset
(
$menu_item
[
'page_arguments'
][
0
])
&&
(
$term
=
taxonomy_term_load
(
$menu_item
[
'page_arguments'
][
0
]))
)
{
$types
[
'taxonomy'
]
=
$term
;
$pattern
=
variable_get
(
'page_title_uc_catalog_'
.
$types
[
'taxonomy'
]
->
vid
,
''
);
}
}
/**
* Implementation of hook_page_title_settings().
*/
function
uc_catalog_page_title_settings
()
{
$settings
=
array
();
$vocabs
=
taxonomy_get_vocabularies
();
foreach
(
$vocabs
as
$vocab
)
{
$settings
[
'page_title_uc_catalog_'
.
$vocab
->
vid
]
=
array
(
'label'
=>
'Ubercart Catalog - %vocab_name'
,
'label arguments'
=>
array
(
'%vocab_name'
=>
$vocab
->
name
),
'scopes'
=>
array
(
'global'
,
'taxonomy'
),
'show field'
=>
FALSE
,
'description'
=>
'This pattern will be used for all %vocab_name Ubercart catalog pages.<br />'
.
'The Show Field setting does not apply here. Use the matching Vocabulary row.'
,
'description arguments'
=>
array
(
'%vocab_name'
=>
$vocab
->
name
),
);
}
return
$settings
;
}
page_title.module
View file @
b20a1d71
...
...
@@ -837,6 +837,7 @@ function forum_page_title_api() { return page_title_page_title_api(); }
function
user_page_title_api
()
{
return
page_title_page_title_api
();
}
function
blog_page_title_api
()
{
return
page_title_page_title_api
();
}
function
views_page_title_api
()
{
return
page_title_page_title_api
();
}
function
uc_catalog_page_title_api
()
{
return
page_title_page_title_api
();
}
/**
...
...
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