function og_menu_default_links_batch_default_links_process in Organic Groups Menu (OG Menu) 7.3
Process Batch request and update all specified menus.
1 string reference to 'og_menu_default_links_batch_default_links_process'
- og_menu_default_links_batch_default_links in contrib/
og_menu_default_links/ og_menu_default_links.module - Batch Manager.
File
- contrib/
og_menu_default_links/ og_menu_default_links.batch.inc, line 10 - Implements batch handling for default menu links.
Code
function og_menu_default_links_batch_default_links_process($menus, &$context) {
if (!isset($context['sandbox']['progress'])) {
$context['sandbox']['progress'] = 0;
$context['sandbox']['current_menu'] = 0;
$context['sandbox']['max'] = count($menus);
$context['sandbox']['menus'] = $menus;
}
// For this example, we decide that we can safely process
// 5 nodes at a time without a timeout.
$limit = 5;
// With each pass through the callback, retrieve the next group of nids.
$slice = array_slice($context['sandbox']['menus'], $context['sandbox']['progress'], $limit, TRUE);
foreach ($slice as $key => $menu) {
_og_menu_default_links_set_default_links($menu, 'update');
// Store some result for post-processing in the finished callback.
$context['results'][] = $menu;
// Update our progress information.
$context['sandbox']['progress']++;
$context['sandbox']['current_menu'] = $menu;
$context['message'] = t('Now processing %menu', array(
'%menu' => $menu,
));
}
// Inform the batch engine that we are not finished,
// and provide an estimation of the completion level we reached.
if ($context['sandbox']['progress'] != $context['sandbox']['max']) {
$context['finished'] = $context['sandbox']['progress'] / $context['sandbox']['max'];
}
}