The following warnings occurred:
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/printthread.php 203 postParser->parse_message



GetSimple Support Forum
Customfields API - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Developer Discussions (http://get-simple.info/forums/forumdisplay.php?fid=8)
+--- Thread: Customfields API (/showthread.php?tid=1965)



Customfields API - Carlos - 2011-07-17

What must a plugin do to insert its own field(s) to the customfields.xml file? Any recommended way?


Customfields API - Carlos - 2011-07-18

...or maybe I should have asked first:

Might plugins use CustomFields for their own fields?
Or is it better to leave that for user-created fields only, and keep adding the fields the usual way? (using changedata-save and edit-extras hooks)


Customfields API - mvlcek - 2011-08-08

Carlos Wrote:What must a plugin do to insert its own field(s) to the customfields.xml file? Any recommended way?

Carlos Wrote:...or maybe I should have asked first:

Might plugins use CustomFields for their own fields?
Or is it better to leave that for user-created fields only, and keep adding the fields the usual way? (using changedata-save and edit-extras hooks)

Sorry for answering late - I was on vacation.
Assuming you are using the I18N Custom Filelds plugin:
  • The fields in customfields.xml are displayed to the user, when he edits the page
  • However, any other fields you add to a page during changedata-save can also be accessed using get/return_custom_field (e.g. the field creDate put there by the plugin itself.
  • There is no function to write to customfields.xml - you have to read/modify/write the file yourself in your plugin (and check if the field is already there, ...)
  • If you want to use a custom field in your plugin, you can ask the user to add it - like the I18N plugin "if you want to have external links, add a custom field link and ...". Then check it in your plugin:
Code:
if (function_exists('return_custom_field')) { // I18N Custom Fields installed?
  $field = return_custom_field('my_field','default');
  ...
}