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):

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

Notice the PHP array:

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:

function share_file_form() {
 ...
}
function share_file_email() {
 ...
}


3.  then call them with URLs like:

index.php?
option=com_flexicontent
&tmpl=component
&task=call_extfunc
&exttype=plugins
&extfolder=flexicontent_fields
&extname=file
&extfunc=share_file_form
&var1=val1
&var2=val2
&var3=val3