function _paging_split_content in Paging 7
Function splits field value into chunks for pagination.
1 call to _paging_split_content()
- paging_field_formatter_view in ./
paging.module - Implements hook_field_formatter_view().
File
- ./
paging.module, line 642 - Allows a node to be broken into multiple pages via a tag.
Code
function _paging_split_content($item, $node, $lang, $delta) {
// If paging is enabled for this node type.
if (variable_get('paging_enabled_' . $node->type, 0) == TRUE && isset($node->paging[$lang]['page_count'])) {
// Get the paging field name.
$field = variable_get('paging_field_' . $node->type, 0);
// Set an element value for this pager.
$element = 0;
// Pull page from the URL query string.
$page = isset($_GET['page']) ? $_GET['page'] : '';
// Put the current page contents into the body.
$format = $node->{$field}[$lang][$delta]['format'];
if ($node->paging[$lang]['page_count'] > 1 && arg(2) != 'print' && arg(2) != 'full' && $page != 'full') {
// Store the page in here, for safe keeping.
$current_page = explode(',', $page);
// Clean up page number for use later on.
$page = $current_page[$element] != '' ? $current_page[$element] : 0;
$output = check_markup($node->paging[$lang]['pages'][$page], $format, FALSE);
}
elseif ($node->paging[$lang]['page_count'] == 1 || arg(2) != 'full' || $page != 'full') {
$value = isset($item['safe_value']) ? $item['safe_value'] : $item['value'];
$output = check_markup($value, $format, FALSE);
}
return $output;
}
}