How to trigger onDisplayField function of some plugin from another plugin

More
6 years 3 months 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.

More
6 years 3 months 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.

More
6 years 3 months 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...

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

More
6 years 3 months ago - 6 years 3 months 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..??
Last edit: 6 years 3 months ago by Ali_wdm.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.379 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline