function shortcut_patterns_export_all_link in Patterns 7.2
Returns a set of PATTERNS_CREATE actions with the whole set of links currently stored in the system.
Parameters
string $args:
string $result:
Return value
array $actions
1 string reference to 'shortcut_patterns_export_all_link'
- shortcut_patterns in patterns_components/
components/ shortcut.inc - Implements hook_patterns().
File
- patterns_components/
components/ shortcut.inc, line 102 - Patterns component for shortcut.
Code
function shortcut_patterns_export_all_link($args = NULL, $result = NULL) {
//Loop through the elements in the set to prepare the actions
$sets = shortcut_sets();
$actions = array();
switch ($args['type']) {
case PATTERNS_CREATE:
foreach ($sets as $set_name) {
//Retrieve all the elements, that are stored as normal menu entries. Shortcuts always have a depth level of 1
$shortcut_links = menu_tree_all_data($set_name->set_name, NULL, 1);
foreach ($shortcut_links as $shortcut_link) {
//Go through elements extracting link_path and link_title fields
$action = array(
PATTERNS_CREATE => array(
'tag' => 'shortcut_link',
'shortcut_set_name' => $set_name->title,
'shortcut_link_title' => $shortcut_link['link']['link_title'],
'shortcut_link_path' => $shortcut_link['link']['link_path'],
),
);
array_push($actions, $action);
}
}
break;
case PATTERNS_MODIFY:
foreach ($sets as $set_name) {
//Retrieve all the elements, that are stored as normal menu entries. Shortcuts always have a depth level of 1
$shortcut_links = menu_tree_all_data($set_name->set_name, NULL, 1);
foreach ($shortcut_links as $shortcut_link) {
//Modify action require new link title and new link path which should be given by someone(website administrator,i.e.)
$action = array(
PATTERNS_MODIFY => array(
'tag' => 'shortcut_link',
'set_name' => $set_name->title,
'link_title' => $shortcut_link['link']['link_title'],
'new_link_title' => 'PleaseGiveNewLinkName',
'new_link_path' => 'PleaseGiveNewLinkPath',
),
);
array_push($actions, $action);
}
}
break;
}
return $actions;
}