function shortcut_patterns_prepare in Patterns 7.2
Same name and namespace in other branches
- 7 patterns_components/components/shortcut.inc \shortcut_patterns_prepare()
hook_patterns_prepare()
File
- patterns_components/
components/ shortcut.inc, line 181 - Patterns component for shortcut.
Code
function shortcut_patterns_prepare($action, $tag, &$data) {
// for set.
if ($tag == 'shortcut_set') {
if ($action == PATTERNS_CREATE) {
$data['new'] = $data['shortcut_set_name'];
}
if ($action == PATTERNS_MODIFY) {
$data['title'] = $data['newname'];
$data['searchtitle'] = $data['oldname'];
}
if ($action == PATTERNS_DELETE) {
$data['searchtitle'] = $data['name'];
}
}
// for switch user
if ($tag == 'shortcut_set_user') {
$data['searchtitle'] = $data['name'];
$data['account'] = NULL;
}
// for link
if ($tag == 'shortcut_link') {
if ($action == PATTERNS_CREATE) {
$data['searchtitle'] = $data['shortcut_set_name'];
$data['shortcut_link']['link_title'] = $data['shortcut_link_title'];
$data['shortcut_link']['link_path'] = $data['shortcut_link_path'];
}
if ($action == PATTERNS_MODIFY) {
$data['shortcut_link']['link_title'] = $data['new_link_title'];
$data['shortcut_link']['link_path'] = $data['new_link_path'];
}
}
return patterns_results();
}