EditForm Custom Fields
(:
title ...:)
markup. Also enables changing the value of a page's 'ctime'. Can be customized to include more fields.Questions answered by this recipe
Can I have a 'Title' input field in the edit-form of PmWiki rather than needing to mention the title of a page inside the (:
title ...:)
markup?
Can I edit a page's 'ctime' (creation time) property from the edit-form of PmWiki? (PmWiki 2.1.beta15 or higher)
Can I edit the existing attributes (like 'title','ctime','author','host',etc.) or add additional attributes to a page from PmWiki's edit-form instead of needing to manually modify the files in wiki.d folder?
Ans: Yes, you can using this recipe. The first two features are provided out-of-the box by this recipe. This enables mentioning the title of a page in a separate input field rather than in the (:
title ...:)
markup. Also enables changing the value of a page's 'ctime'. The third feature (adding additional attributes) requires customization of the recipe to include more customized properties and fields in the edit-form.
Description
Using this recipe you can add "Title", "Creation Date", etc. custom input fields to the edit form of PmWiki. This enables mentioning the title of a page in a separate input field rather than in the <code class='escaped'>(:</code><code class='escaped'>title ...:)</code> markup within the wiki-text. Also enables changing the value of a page's 'ctime'. The recipe can be customized to include more fields.
Sample screenshot:
Installation
- Download the attached editformcustomfields.phpΔ(check file consistency) file and place it in the cookbook/ folder.
- In /local/config.php add the line
include_once('cookbook/editformcustomfields.php');
- Edit the EditForm (generally the page Site.EditForm) to include
(:input e_title:)
and(:input e_ctime:)
where you want the fields to appear.
Notes
PHP variables: The following PHP variables may be set on config.php
Variable | Description | Default |
$customFields_isActive
| An array indicating which custom input fields are active. | array(
|
$ctimeDispFmt
| The date-time format to be used to display and input 'ctime'. | "%Y-%m-%d (%H:%M:%S)"
|
Adding custom fields:
This needs editing of editformcustomfields.php
.To add another property (existing or customized), copy one of the 'if' blocks in editformcustomfields.php
and customize it as desired. Remember to add the corresponding entry in $customFields_isActive.
The future versions will have more friendly ways of adding new/custom fields other than 'title' and 'ctime'.
Release notes
2010-01-27: v1.0 released.
2012-03-15: v1.01 released. Fixed an incompatibility bug. See http://thread.gmane.org/gmane.comp.web.wiki.pmwiki.user/59673 for details on the bug.
See also
Contributors
- Subhrajit -- author
Comments
See discussion at EditFormCustomFields-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.