Please note that Form2Content is no longer being developed. All files from the latest version can be found on Github.

Form2Content Forum

Questions and answers for Form2Content, a Joomla CCK.
  1. Marc
  2. Form2Content Related article plugins
  3. Monday, 29 May 2017
  4.  Subscribe via email
Hi,
I would like to manipulate text with a custom plugin. I understand quite well how to make a plugin and I've already coded a plugin to correct usual mistakes in a text (replace h1 tag, replace space by unbreakable space when this or that, etc.).
I use onBeforeF2cContentSave's function for that.

My problem is that I want to make a plugin which won't change the data in the f2c_fieldcontent but only in the resulting joomla articles' content fields introtext and fulltext.

- I suppose that I have to use onAfterF2cContentParse function. Right?
- How to get the strings, I suppose it is with parsedIntroContent and parsedMainContent ?
- If yes, how to get the content of parsedIntroContent ?
- And how to write back the string after processing ?

Thanks
Accepted Answer
Accepted Answer Pending Moderation
Hi Mark,

Instead of a Joomla plugin you could make a Smarty modifier (is also plugin based).
http://www.smarty.net/docs/en/plugins.modifiers.tpl
When you save the F2C form the data is parsed through the modifier and you get your modified Joomla article html. You can create your own template parameter to activate the Smarty modifier. Like: {$FIELDNAME_MODIFIED}.
Hope this line of thought helps

Regards,
Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so ;)
Responses (7)
Accepted Answer Pending Moderation
Hi Patrick,
I've not been clear but I was speaking about creating F2C custom plugin not a generic joomla plugin.

What I want to achieve is not possible at the F2C custom plugin's stage ?
Thanks
Accepted Answer Pending Moderation
Hi Patrick,

I've been able to achieve what I want with your suggestion, thanks.

However, I would like to know if it is possible to achieve with a F2C custom plugin.

Regards,
Marc
Accepted Answer Pending Moderation
Hi Marc,

A F2C custom plugin has been designed to allow you to do other things with F2C Data. It is not part of the article rendering process. A custom F2C field type would be another option. In this case you can do whatever you want with the collected data before rendering it into the F2C template.

Regards,
Patrick
Please read the F2C documentation before asking questions! Thank you if you've done so ;)
Accepted Answer Pending Moderation
Hi Marc,

Achieving this with a F2C plug-in will be difficult. The onAfterF2cContentParse sounds like a logical place to perform this action, however the data (Joomla article) has already been written to the database at that point.

I think a Joomla plug-in would work in this situation. But I see you already have a solution :)

best,
Julien
Accepted Answer Pending Moderation
Hi Julien,
Thanks for your input.
Yes I have a workable solution but I would like to fully understand (well, at least a little better…) the different events.

Could you explain the 6 events like that please ?

onBeforeF2cContentSave = manipulate data and write it in the f2c_fieldcontent

etc, etc.

Regards,
Marc
Accepted Answer Pending Moderation
Hi Marc,

Here's a summary of what you can do:

onBeforeF2cContentSave

Modify the F2C fields data before it's written to the database

onAfterF2cContentSave

Read the stored F2C fields data, for example to update 3rd party tables with the data

onBeforeF2cContentDelete

Delete related 3rd party data, perform some checks, or prevent the delete

onAfterF2cContentDelete

Do some post-processing after a delete, for example clean-up files or data in 3rd party tables

onBeforeF2cContentParse

Modify the F2C fields data before it will be parsed. F2C Field data is not written to the database

onAfterF2cContentParse

Use the read-only parsed-content to update 3rd party tables

best,
Julien
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.