1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

how to use new fabrikworker (SOLVED)

Discussion in 'Professional Support' started by creanet, Jul 27, 2018.

Thread Status:
Not open for further replies.
  1. creanet

    creanet New Member

    Level: Professional
    Hi again,
    I have a calc element with this code :

    setlocale(LC_TIME, "fr_FR.UTF-8");
    $db = JFactory::getDbo();
    $modele = $db->Quote('{fk_devis___modele_raw}');
    $myWorker = new FabrikWorker;
    $query = "SELECT introtext FROM gkd7v_content WHERE id=$modele";
    $db->setQuery($query);
    $contenu = $db->loadResult();
    $content = $myWorker->parseMessageForPlaceHolder($contenu, $formModel->data);
    return $content;

    wich returns
    :Notice: Undefined variable: formModel in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(104) : eval()'d code on line 8

    Notice: Trying to get property of non-object in /home/toursinnei/www/plugins/fabrik_element/calc/calc.php(104) : eval()'d code on line 8

    and var_dump($myWorker) returns NULL

    Could you please explain to me how to use the new FabrikWorker and parseMessageForPlaceHolder ?
     
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    That should be correct. There's a class alias of FabrikWorker, which points to the new namespaced \Fabrik\Helpers\Worker.

    Use $data instead of $formModel->data. The data isn't always in $formModel (for example if a calc is running in list view), but we make sure the local $data variable always contains the form's data.

    -- hugh
     
  3. creanet

    creanet New Member

    Level: Professional
    Ths it's work with $data
     
Thread Status:
Not open for further replies.

Share This Page