How to get some specific field attributes ?

More
12 years 2 months ago #22869 by bancil
Hi everybody,

How to get field parameters like associated plugins with the field or the state of its "onPrepareContent" attribute ?
Something like $this->item->fields[‘myField’] ->parameters->get(‘valueOfMyField’)...???

thanks !

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

More
12 years 2 months ago #22884 by ggppdk
mmm, not sure what you mean

onPrepareContent is an event not an attribute,
when the event is triggered it alters the text of the field

you want to know which plugins were triggered?

actually the joomla content plugins were never designed to be triggered selectively, this means when you call the event "onPrepareContent", then all content plugins loaded so far will be triggered,

so if field1 triggers all content plugins then if you trigger onPrepareContent for field2 then all plugins will be triggered since field1 has already loaded all of them,

it is possible to trigger content plugins directly like we do for flexicontent fields which are joomla plugins too, but there is an implication that i will not try to explain and confuse you more

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
12 years 2 months ago #22885 by ggppdk
If you want to see the available parameter names there are a lot of ways, calling print_r() on parameters OR viewing the XML file of the field OR doing browser's "view page source" in field edit form , or using firebug

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
12 years 2 months ago #22895 by bancil
Thanks a lot for your explanation, it's very clear.
In fact, I'd like to trigger or not onPrepareContent for my field, depending on the result of a test in my item.php.

Regards

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

More
12 years 2 months ago #22905 by ggppdk
In this case disable the CONTENT plugin triggering in the field configuration and use something like
Code:
$dispatcher = &JDispatcher::getInstance(); $limitstart = JRequest::getVar('limitstart', 0, '', 'int'); $field->text = isset($field->display) ? $field->display : ''; $field->title = $this->item->title; JPluginHelper::importPlugin('content'); $field->slug = $this->item->slug; $field->sectionid = $this->item->sectionid; $field->catid = $this->item->catid; $field->catslug = @$this->item->categoryslug; $field->fieldid = $field->id; $field->id = $this->item->id; $field->state = $this->item->state; $results = $dispatcher->trigger('onPrepareContent', array (&$field, &$this->params, $limitstart)); $field->id = $field->fieldid; // restore field id $field->display = $field->text; // use text produced by plugins


-- 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
12 years 1 month ago #23104 by bancil
thank you very much ggppdk !
It works perfectly.
Best regards

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

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