Calling FLEXIcontent field functions as controller TASKs

  • Published by
    George Papadakis
  • Last modified
    26 June 2014
  • Up to date
    Yes
  • Profile concerned
    Developer
  • Concerns
    Plugins
  • Since Version
    2.0
  • Voting
    Average rating
    2 votes
    • 1
    • 2
    • 3
    • 4
    • 5
  • Favourites
    575 Calling FLEXIcontent field functions as controller TASKs /documentation/tutorials-english/70-developer-api-field-plugins/575-calling-flexicontent-field-functions-as-controller-tasks.html

FLEXIcontent frontend controller supports calling functions inside a flexicontent plugins as TASKs ... !!

This way you can extend flexicontent controller without hacking it

NOTE: these functions can of course be called via AJAX too


1. Place your functions inside the joomla plugin (flexicontent field)

e.g. see the code of our "file" field (joomla plugin):

  1. class plgFlexicontent_fieldsFile extends JPlugin
  2. {
  3. static $field_types = array('file');
  4. var $task_callable = array('share_file_form', 'share_file_email');

Notice the PHP array:

  1. var $task_callable = array('share_file_form', 'share_file_email');

[b]which states which functions are allowed to be called directly[/b]

2. then of course add the needed functions to the plugin in our example:

  1. function share_file_form() {
  2. ...
  3. }
  4. function share_file_email() {
  5. ...
  6. }


3.  then call them with URLs like:

  1. index.php?
  2. option=com_flexicontent
  3. &tmpl=component
  4. &task=call_extfunc
  5. &exttype=plugins
  6. &extfolder=flexicontent_fields
  7. &extname=file
  8. &extfunc=share_file_form
  9. &var1=val1
  10. &var2=val2
  11. &var3=val3