src/View/Helper/FormatHelper.php
public function neighbors(array $neighbors, $field, array $options = []) {
		$name = 'Record'; // Translation further down!
		if (!empty($options['name'])) {
			$name = ucfirst($options['name']);
		}

		$prevSlug = $nextSlug = null;
		if (!empty($options['slug'])) {
			if (!empty($neighbors['prev'])) {
				$prevSlug = $this->slug($neighbors['prev'][$field]);
			}
			if (!empty($neighbors['next'])) {
				$nextSlug = $this->slug($neighbors['next'][$field]);
			}
		}
		$titleField = $field;
		if (!empty($options['titleField'])) {
			$titleField = $options['titleField'];
		}
		if (!isset($options['escape']) || $options['escape'] === false) {
			$titleField = h($titleField);
		}

		$ret = '<div class="next-prev-navi nextPrevNavi">';
		if (!empty($neighbors['prev'])) {
			$url = [$neighbors['prev']['id'], $prevSlug];
			if (!empty($options['url'])) {
				$url += $options['url'];
			}

			$ret .= $this->Html->link(
				$this->icon('prev') . '&nbsp;' . __d('tools', 'prev' . $name),
				$url,
				['escape' => false, 'title' => $neighbors['prev'][$titleField]]
			);
		} else {
			$ret .= $this->icon('prev');
		}

		$ret .= '&nbsp;&nbsp;';
		if (!empty($neighbors['next'])) {
			$url = [$neighbors['next']['id'], $nextSlug];
			if (!empty($options['url'])) {
				$url += $options['url'];
			}

			$ret .= $this->Html->link(
				$this->icon('next') . '&nbsp;' . __d('tools', 'next' . $name),
				$url,
				['escape' => false, 'title' => $neighbors['next'][$titleField]]
			);
		} else {
			$ret .= $this->icon('next') . '&nbsp;' . __d('tools', 'next' . $name);
		}

		$ret .= '</div>';

		return $ret;
	}
public function neighbors(array $neighbors, $field, array $options = []) {
		$name = 'Record'; // Translation further down!
		if (!empty($options['name'])) {
			$name = ucfirst($options['name']);
		}

		$prevSlug = $nextSlug = null;
		if (!empty($options['slug'])) {
			if (!empty($neighbors['prev'])) {
				$prevSlug = $this->slug($neighbors['prev'][$field]);
			}
			if (!empty($neighbors['next'])) {
				$nextSlug = $this->slug($neighbors['next'][$field]);
			}
		}
		$titleField = $field;
		if (!empty($options['titleField'])) {
			$titleField = $options['titleField'];
		}
		if (!isset($options['escape']) || $options['escape'] === false) {
			$titleField = h($titleField);
		}

		$ret = '<div class="next-prev-navi nextPrevNavi">';
		if (!empty($neighbors['prev'])) {
			$url = [$neighbors['prev']['id'], $prevSlug];
			if (!empty($options['url'])) {
				$url += $options['url'];
			}

			$ret .= $this->Html->link(
				$this->icon('prev') . '&nbsp;' . __d('tools', 'prev' . $name),
				$url,
				['escape' => false, 'title' => $neighbors['prev'][$titleField]]
			);
		} else {
			$ret .= $this->icon('prev');
		}

		$ret .= '&nbsp;&nbsp;';
		if (!empty($neighbors['next'])) {
			$url = [$neighbors['next']['id'], $nextSlug];
			if (!empty($options['url'])) {
				$url += $options['url'];
			}

			$ret .= $this->Html->link(
				$this->icon('next') . '&nbsp;' . __d('tools', 'next' . $name),
				$url,
				['escape' => false, 'title' => $neighbors['next'][$titleField]]
			);
		} else {
			$ret .= $this->icon('next') . '&nbsp;' . __d('tools', 'next' . $name);
		}

		$ret .= '</div>';

		return $ret;
	}
public function neighbors ( array $ neighbors , $ field , array $ options = [ ] ) { $ name = 'Record' ; // Translation further down! if ( ! empty ( $ options [ 'name' ] ) ) { $ name = ucfirst ( $ options [ 'name' ] ) ; } $ prevSlug = $ nextSlug = null ; if ( ! empty ( $ options [ 'slug' ] ) ) { if ( ! empty ( $ neighbors [ 'prev' ] ) ) { $ prevSlug = $ this -> slug ( $ neighbors [ 'prev' ] [ $ field ] ) ; } if ( ! empty ( $ neighbors [ 'next' ] ) ) { $ nextSlug = $ this -> slug ( $ neighbors [ 'next' ] [ $ field ] ) ; } } $ titleField = $ field ; if ( ! empty ( $ options [ 'titleField' ] ) ) { $ titleField = $ options [ 'titleField' ] ; } if ( ! isset ( $ options [ 'escape' ] ) || $ options [ 'escape' ] === false ) { $ titleField = h ( $ titleField ) ; } $ ret = '<div class="next-prev-navi nextPrevNavi">' ; if ( ! empty ( $ neighbors [ 'prev' ] ) ) { $ url = [ $ neighbors [ 'prev' ] [ 'id' ] , $ prevSlug ] ; if ( ! empty ( $ options [ 'url' ] ) ) { $ url += $ options [ 'url' ] ; } $ ret .= $ this -> Html -> link ( $ this -> icon ( 'prev' ) . '&nbsp;' . __d ( 'tools' , 'prev' . $ name ) , $ url , [ 'escape' => false , 'title' => $ neighbors [ 'prev' ] [ $ titleField ] ] ) ; } else { $ ret .= $ this -> icon ( 'prev' ) ; } $ ret .= '&nbsp;&nbsp;' ; if ( ! empty ( $ neighbors [ 'next' ] ) ) { $ url = [ $ neighbors [ 'next' ] [ 'id' ] , $ nextSlug ] ; if ( ! empty ( $ options [ 'url' ] ) ) { $ url += $ options [ 'url' ] ; } $ ret .= $ this -> Html -> link ( $ this -> icon ( 'next' ) . '&nbsp;' . __d ( 'tools' , 'next' . $ name ) , $ url , [ 'escape' => false , 'title' => $ neighbors [ 'next' ] [ $ titleField ] ] ) ; } else { $ ret .= $ this -> icon ( 'next' ) . '&nbsp;' . __d ( 'tools' , 'next' . $ name ) ; } $ ret .= '</div>' ; return $ ret ; }
Display neighbor quicklinks

@param array $neighbors (containing prev and next)
@param string $field : just field or Model.field syntax
@param array $options :
- name: title name: next{Record} (if none is provided, "record" is used - not translated!)
- slug: true/false (defaults to false)
- titleField: field or Model.field
@return string
Display neighbor quicklinks