Timber\Post::next PHP Метод

next() публичный Метод

public next ( boolean $in_same_term = false ) : mixed
$in_same_term boolean
Результат mixed
    public function next($in_same_term = false)
    {
        if (!isset($this->_next) || !isset($this->_next[$in_same_term])) {
            global $post;
            $this->_next = array();
            $old_global = $post;
            $post = $this;
            if ($in_same_term) {
                $adjacent = get_adjacent_post(true, '', false, $in_same_term);
            } else {
                $adjacent = get_adjacent_post(false, '', false);
            }
            if ($adjacent) {
                $this->_next[$in_same_term] = new $this->PostClass($adjacent);
            } else {
                $this->_next[$in_same_term] = false;
            }
            $post = $old_global;
        }
        return $this->_next[$in_same_term];
    }