|
@@ -30,7 +30,8 @@ use Cake\View\View;
|
|
|
class HtmlHelper extends CoreHtmlHelper {
|
|
class HtmlHelper extends CoreHtmlHelper {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * Creates a default HTML link.
|
|
|
|
|
|
|
+ * Creates a reset HTML link.
|
|
|
|
|
+ * The prefix and plugin params are resetting to default false.
|
|
|
*
|
|
*
|
|
|
* ### Options
|
|
* ### Options
|
|
|
*
|
|
*
|
|
@@ -40,20 +41,47 @@ class HtmlHelper extends CoreHtmlHelper {
|
|
|
* - `confirm` JavaScript confirmation message.
|
|
* - `confirm` JavaScript confirmation message.
|
|
|
*
|
|
*
|
|
|
* @param string $title The content to be wrapped by <a> tags.
|
|
* @param string $title The content to be wrapped by <a> tags.
|
|
|
- * @param string|array|null $url Cake-relative URL or array of URL parameters, or
|
|
|
|
|
|
|
+ * @param string|array|null $url URL or array of URL parameters, or
|
|
|
* external URL (starts with http://)
|
|
* external URL (starts with http://)
|
|
|
* @param array $options Array of options and HTML attributes.
|
|
* @param array $options Array of options and HTML attributes.
|
|
|
* @return string An `<a />` element.
|
|
* @return string An `<a />` element.
|
|
|
- * @link http://book.cakephp.org/3.0/en/views/helpers/html.html#creating-links
|
|
|
|
|
*/
|
|
*/
|
|
|
- public function defaultLink($title, $url = null, array $options = []) {
|
|
|
|
|
-
|
|
|
|
|
|
|
+ public function resetLink($title, $url = null, array $options = []) {
|
|
|
if (is_array($url)) {
|
|
if (is_array($url)) {
|
|
|
$url += ['prefix' => false, 'plugin' => false];
|
|
$url += ['prefix' => false, 'plugin' => false];
|
|
|
}
|
|
}
|
|
|
return parent::link($title, $url, $options);
|
|
return parent::link($title, $url, $options);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * Keep query string params for pagination/filter for this link,
|
|
|
|
|
+ * e.g. after edit action.
|
|
|
|
|
+ *
|
|
|
|
|
+ * ### Options
|
|
|
|
|
+ *
|
|
|
|
|
+ * - `escape` Set to false to disable escaping of title and attributes.
|
|
|
|
|
+ * - `escapeTitle` Set to false to disable escaping of title. Takes precedence
|
|
|
|
|
+ * over value of `escape`)
|
|
|
|
|
+ * - `confirm` JavaScript confirmation message.
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param string $title The content to be wrapped by <a> tags.
|
|
|
|
|
+ * @param string|array|null $url URL or array of URL parameters, or
|
|
|
|
|
+ * external URL (starts with http://)
|
|
|
|
|
+ * @param array $options Array of options and HTML attributes.
|
|
|
|
|
+ * @return string An `<a />` element.
|
|
|
|
|
+ * @return string Link
|
|
|
|
|
+ */
|
|
|
|
|
+ public function completeLink($title, $url = null, array $options = []) {
|
|
|
|
|
+ if (is_array($url)) {
|
|
|
|
|
+ // Add query strings
|
|
|
|
|
+ if (!isset($url['?'])) {
|
|
|
|
|
+ $url['?'] = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ $url['?'] += $this->request->query;
|
|
|
|
|
+ }
|
|
|
|
|
+ return parent::link($title, $url, $options);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* Event listeners.
|
|
* Event listeners.
|
|
|
*
|
|
*
|