[Solved] Execute plugins in onDisplayFieldValue

More
11 years 10 months ago - 11 years 10 months ago #26492 by yaK2manD
Hi,

I have modified the onDisplayFieldValue function in order to display some things which require plugins.

For example, I use allVideo plugins, and in the onDisplayFieldValue, I have put :
Code:
$field->{$prop} = '{youtube}I_xFWKi0xGQ{/youtube}';
By the way, it is a test to execute plugin through onDisplayFieldValue.

How can I do to allow plugin to be executed through onDisplayFieldValue ?

Thank you.
Last edit: 11 years 10 months ago by yaK2manD.

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

More
11 years 10 months ago #26497 by ggppdk
You can enable content plugin triggering in field's configuration (backend field manager).

You do not need to create a custom field for what you suggest, since you can use the text field to achieve this.

Also please read:
www.flexicontent.org/documentati ... ntent.html

Regards


-- 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
11 years 10 months ago #26552 by yaK2manD
Thank you for your answer.

In fact, in order to enable oncontentprepare, I had to add, in myfield.xml :
Code:
<fieldset name="group-myfield" addfieldpath="/administrator/components/com_flexicontent/elements"> <field name="trigger_onprepare_content" type="radio" default="0" label="FLEXI_ENABLE_TRIGGER_ONPREPARECONTENT_EVENT" description="FLEXI_ENABLE_TRIGGER_ONPREPARECONTENT_EVENT_DESC"> <option value="0">FLEXI_NO</option> <option value="1">FLEXI_YES</option> </field> <field name="plugins" type="pluginlist" label="FLEXI_FIELD_CHOOSE_SPECIFIC_PLUGINS" description="FLEXI_FIELD_CHOOSE_SPECIFIC_PLUGINS_DESC" /> <field name="required" type="radio" default="0" label="FLEXI_REQUIRED" description="FLEXI_REQUIRED_DESC"> <option value="0">FLEXI_NO</option> <option value="1">FLEXI_YES</option> </field> </fieldset>




However, I have a problem, when I use :
Code:
if (JRequest::getCmd( 'option' ) == 'flexicontent' && JRequest::getCmd( 'view' ) == FLEXI_ITEMVIEW) { $field->{$prop} = '{'.$value['server'].'}'.$value['video_id'].'{/'.$value['server'].'}'; } if (JRequest::getCmd( 'option' ) == 'flexicontent' && JRequest::getCmd( 'view' ) == 'category') { $field->{$prop} = '<img src="'.$value['image'].'" >'; }

I get :

Warning: preg_match() expects parameter 2 to be string, array given in C:\wamp\www\test\plugins\content\jplayer\jplayer.php on line 42

Warning: preg_match() expects parameter 2 to be string, array given in C:\wamp\www\test\plugins\content\jw_allvideos\jw_allvideos.php on line 67

Warning: strpos() expects parameter 1 to be string, array given in C:\wamp\www\test\plugins\content\loadmodule\loadmodule.php on line 32

Warning: preg_match_all() expects parameter 2 to be string, array given in C:\wamp\www\test\plugins\content\loadmodule\loadmodule.php on line 46

Warning: preg_match_all() expects parameter 2 to be string, array given in C:\wamp\www\test\plugins\content\loadmodule\loadmodule.php on line 68

Warning: mb_strpos() expects parameter 1 to be string, array given in C:\wamp\www\test\libraries\phputf8\mbstring\core.php on line 44

Warning: mb_strpos() expects parameter 1 to be string, array given in C:\wamp\www\test\libraries\phputf8\mbstring\core.php on line 44

Warning: mb_strpos() expects parameter 1 to be string, array given in C:\wamp\www\test\libraries\phputf8\mbstring\core.php on line 44


When I don't use the category/item behavior, I have no error.


Where could it come from ?

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

More
11 years 10 months ago #26553 by yaK2manD
Problem solved.

I have modified the code :
Code:
// initialise property $field->{$prop} = ''; $value = unserialize($values[0]); $view = JRequest::setVar('view', JRequest::getVar('view', FLEXI_ITEMVIEW)); if ($view == 'category') { $field->{$prop} ='<img src="'.$value['image'].'" >'; } else { $field->{$prop} = '{'.$value['server'].'}'.$value['video_id'].'{/'.$value['server'].'}'; }

Works well

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

More
11 years 10 months ago #26558 by ggppdk
Yes you need that if you create a new field
but in your case you could have sticked to the text field, and enable CONTENT plugin triggering in field configuration.


-- 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.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.698 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