EditThisPageLink
Description
The following markup definition provides a short (:edit:)
markup, which is exactly equivalent to the longer standard [[{$FullName}?action=edit|edit]]
link markup. For instance you can use it on included pages as a shortform to provide a link to edit the included page. Add this to config.php:
Markup('(:edit:)', '<$[phrase]', '/\\(:edit:\\)/i', "[[{\$FullName}?action=edit| $[Edit] ]]"); $QualifyPatterns['/\\(:edit:\\)/i'] = "[[{\$FullName}?action=edit| $[Edit] ]]";
Explanation
$QualifyPatterns
: When the (:include:)
directive retrieves a page content, the included text is processed (qualified) to transform "relative" variable references to "absolute" ones, {$SomeVar}
in the included page becomes {Group.IncludedPage$SomeVar}
, which resolves as expected when the page is finally rendered.
The internal $QualifyPatterns
variable maintains the dedicated search/replacement regular expressions.
Release Notes
- 201171121: Simplify patterns to not use function evaluation, also making it PHP 5.5 and 7.2 compatible. Allow labels to be translatable. (Petko)
See Also
Contributors
Comments
See discussion at EditThisPageLink-Talk
User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.