Browse Source

use the html helper css template

AD7six 11 years ago
parent
commit
5fef4de99a

+ 5 - 6
src/View/Helper/PaginatorHelper.php

@@ -34,7 +34,7 @@ class PaginatorHelper extends Helper {
  *
  * @var array
  */
-	public $helpers = ['Url', 'Number'];
+	public $helpers = ['Url', 'Number', 'Html'];
 
 /**
  * Default config for this class
@@ -73,7 +73,6 @@ class PaginatorHelper extends Helper {
 			'sortDesc' => '<a class="desc" href="{{url}}">{{text}}</a>',
 			'sortAscLocked' => '<a class="asc locked" href="{{url}}">{{text}}</a>',
 			'sortDescLocked' => '<a class="desc locked" href="{{url}}">{{text}}</a>',
-			'metaLink' => '<link rel="{{type}}" href="{{url}}">',
 		]
 	];
 
@@ -836,15 +835,15 @@ class PaginatorHelper extends Helper {
 		$links = [];
 
 		if ($this->hasPrev()) {
-			$links[] = $this->templater()->format('metaLink', [
-				'type' => 'prev',
+			$links[] = $this->Html->templater()->format('css', [
+				'rel' => 'prev',
 				'url' => $this->generateUrl(['page' => $params['page'] - 1], null, true)
 			]);
 		}
 
 		if ($this->hasNext()) {
-			$links[] = $this->templater()->format('metaLink', [
-				'type' => 'next',
+			$links[] = $this->Html->templater()->format('css', [
+				'rel' => 'next',
 				'url' => $this->generateUrl(['page' => $params['page'] + 1], null, true)
 			]);
 		}

+ 6 - 5
tests/TestCase/View/Helper/PaginatorHelperTest.php

@@ -2057,7 +2057,7 @@ class PaginatorHelperTest extends TestCase {
 			)
 		);
 
-		$expected = '<link rel="next" href="http://localhost/index?page=2">';
+		$expected = '<link rel="next" href="http://localhost/index?page=2"/>';
 		$result = $this->Paginator->meta();
 		$this->assertSame($expected, $result);
 	}
@@ -2077,7 +2077,7 @@ class PaginatorHelperTest extends TestCase {
 			)
 		);
 
-		$expected = '<link rel="next" href="http://localhost/index?page=2">';
+		$expected = '<link rel="next" href="http://localhost/index?page=2"/>';
 		$this->Paginator->meta(['block' => true]);
 		$result = $this->View->fetch('meta');
 		$this->assertSame($expected, $result);
@@ -2098,8 +2098,9 @@ class PaginatorHelperTest extends TestCase {
 			)
 		);
 
-		$expected = '<link rel="prev" href="http://localhost/index">';
+		$expected = '<link rel="prev" href="http://localhost/index"/>';
 		$result = $this->Paginator->meta();
+
 		$this->assertSame($expected, $result);
 	}
 
@@ -2118,8 +2119,8 @@ class PaginatorHelperTest extends TestCase {
 			)
 		);
 
-		$expected = '<link rel="prev" href="http://localhost/index?page=4">';
-		$expected .= '<link rel="next" href="http://localhost/index?page=6">';
+		$expected = '<link rel="prev" href="http://localhost/index?page=4"/>';
+		$expected .= '<link rel="next" href="http://localhost/index?page=6"/>';
 		$result = $this->Paginator->meta();
 		$this->assertSame($expected, $result);
 	}