How to trigger onDisplayField function of some plugin from another plugin

4 months 2 days ago #71199 by Ali_wdm
I have created two flexi field plugin, I want to change value of one plugin on the basis of other plugin by ajax request. What have I to do...??

Please Log in or Create an account to join the conversation.

4 months 2 days ago #71203 by Ali_wdm
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'classes'.DS.'flexicontent.helper.php');
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'classes'.DS.'flexicontent.fields.php');
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'helpers'.DS.'permission.php');
require_once (JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'items.php');
require_once(JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.'item.php');

$item_model = new FlexicontentModelItem();
$item1 = array();
$field1 = array();

FLEXIUtilities::call_FC_Field_Func('questionnaire', 'onDisplayField', array(&$field1, &$item1) );

This code trigger the 'onDisplayField' event of other plugin, problem is that how to set value of $field1 and $item1.

Please Log in or Create an account to join the conversation.

4 months 1 day ago #71211 by ggppdk
Hello

Where is your code being executed ?
are you calling a custom script ?

you can query the DB table for field values directly for 1 field

then update it for the other field
just update all columns of the row appropriately


-- FLEXIcontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star review. Thanks!

Please Log in or Create an account to join the conversation.

4 months 1 day ago - 3 months 4 weeks ago #71212 by Ali_wdm
I am calling this function from one plugin file using com_ajax.

// Method to trigger Questionnaire onDisplayField event via Ajax //using com_ajax method
public function onAjaxTriggerQuestionnaireEvent()
{
JTable::addIncludePath(JPATH_ADMINISTRATOR.DS.'components'.DS.'com_flexicontent'.DS.'tables');
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'classes'.DS.'flexicontent.helper.php');
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'classes'.DS.'flexicontent.fields.php');
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'helpers'.DS.'permission.php');
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'helpers'.DS.'route.php');
require_once (JPATH_SITE.DS.'components'.DS.'com_flexicontent'.DS.'models'.DS.FLEXI_ITEMVIEW.'.php');

$postData = JRequest::get( 'post' );
$formData = $postData;
$tempName = $formData;
$itemId = $formData;
$item_model = new FlexicontentModelItem();

if($itemId)
{
$item = $item_model->getItem($itemId, $check_view_access=false, $no_cache=false, $force_version=0);
}
else
{
$item = $item_model->getItem(null, $check_view_access=false, $no_cache=false, $force_version=0);
}
print_r($item);jexit();
$user = JFactory::getUser();
$aid = JAccess::getAuthorisedViewLevels($user->id);

$params = & $item->parameters;
$_items = array(&$item);
FlexicontentFields::getFields($_items, FLEXI_ITEMVIEW, $params, $aid);
print_r($item);jexit();
$field1 = array();
try{
$results = FLEXIUtilities::call_FC_Field_Func('questionnaire', 'onDisplayField', array(&$field1, &$item1,$tempName) );

}catch(Exception $e){

}
print_r($results);jexit();
}

When I am trying to get fields by FlexicontentFields::getFields($_items, FLEXI_ITEMVIEW, $params, $aid);, it gives some error.
I got item object by $item = $item_model->getItem($itemId, $check_view_access=false, $no_cache=false, $force_version=0); is it right or wrong..??

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
© 2018 Flexicontent. All Rights Reserved.