| @@ -9,15 +9,20 @@ | ||
| 9 | 9 | * Class Archive_Adjacent. |
| 10 | 10 | * |
| 11 | 11 | * Presentation object for indexables. |
| 12 | 12 | * |
| 13 | - * @property Indexable $model The indexable. | |
| 14 | - * @property Pagination_Helper $pagination The pagination helper. Should be defined in the parent | |
| 15 | - * class because of trait issues in PHP 5.6. | |
| 13 | + * @property Indexable $model The indexable. | |
| 16 | 14 | */ |
| 17 | 15 | trait Archive_Adjacent { |
| 18 | 16 | |
| 19 | 17 | /** |
| 18 | + * Holds the Pagination_Helper instance. | |
| 19 | + * | |
| 20 | + * @var Pagination_Helper | |
| 21 | + */ | |
| 22 | + protected $pagination; | |
| 23 | + | |
| 24 | + /** | |
| 20 | 25 | * Sets the helpers for the trait. |
| 21 | 26 | * |
| 22 | 27 | * @required |
| 23 | 28 | * |
| @@ -23,8 +28,10 @@ | ||
| 23 | 28 | * |
| 24 | 29 | * @codeCoverageIgnore |
| 25 | 30 | * |
| 26 | 31 | * @param Pagination_Helper $pagination The pagination helper. |
| 32 | + * | |
| 33 | + * @return void | |
| 27 | 34 | */ |
| 28 | 35 | public function set_archive_adjacent_helpers( Pagination_Helper $pagination ) { |
| 29 | 36 | $this->pagination = $pagination; |
| 30 | 37 | } |
| @@ -45,12 +52,12 @@ | ||
| 45 | 52 | return ''; |
| 46 | 53 | } |
| 47 | 54 | // Check if the previous page is the first page. |
| 48 | 55 | if ( $current_page === 2 ) { |
| 49 | - return $this->get_permalink(); | |
| 56 | + return $this->permalink; | |
| 50 | 57 | } |
| 51 | 58 | |
| 52 | - return $this->pagination->get_paginated_url( $this->get_permalink(), ( $current_page - 1 ) ); | |
| 59 | + return $this->pagination->get_paginated_url( $this->permalink, ( $current_page - 1 ) ); | |
| 53 | 60 | } |
| 54 | 61 | |
| 55 | 62 | /** |
| 56 | 63 | * Generates the rel next. |
| @@ -66,7 +73,7 @@ | ||
| 66 | 73 | if ( $this->pagination->get_number_of_archive_pages() <= $current_page ) { |
| 67 | 74 | return ''; |
| 68 | 75 | } |
| 69 | 76 | |
| 70 | - return $this->pagination->get_paginated_url( $this->get_permalink(), ( $current_page + 1 ) ); | |
| 77 | + return $this->pagination->get_paginated_url( $this->permalink, ( $current_page + 1 ) ); | |
| 71 | 78 | } |
| 72 | 79 | } |