The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
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
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Customfields API
#1
What must a plugin do to insert its own field(s) to the customfields.xml file? Any recommended way?
Reply
#2
...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)
Reply
#3
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');
  ...
}
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply




Users browsing this thread: 1 Guest(s)