Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function MY_MODULE_node_view($node, $view_mode, $langcode) {
- if ($node->type == 'node_type' && $view_mode == 'full') {
- if ($node->content['webform']['#enabled']) {
- $current_page = (int)$node->content['webform']['#form']['details']['page_num']['#value'];
- $page_count = (int)$node->content['webform']['#form']['details']['page_count']['#value'];
- $list = range(1, $page_count);
- $nav = array(
- 'type' => 'ul',
- 'attributes' => array(
- 'class' => 'webform-navigation',
- ),
- 'title' => NULL,
- 'items' => array(),
- );
- foreach ($list as $v) {
- $nav['items'][$v] = array(
- 'data' => t('Step @count', array('@count' => $v)),
- );
- if ($v < $current_page) $nav['items'][$v]['class'][] = 'complete';
- if ($v === $current_page) {
- $nav['items'][$v]['class'][] = 'active';
- $nav['items'][$v]['title'] = t('You are currently on step @count of @full', array('@count' => $v, '@full' => $page_count));
- }
- }
- $node->content['navigation'] = array(
- '#title' => $nav['title'],
- '#items' => $nav['items'],
- '#type' => $nav['type'],
- '#attributes' => $nav['attributes'],
- '#weight' => -10,
- '#theme' => 'item_list',
- );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement