FeildsHelper::extract() Question

65 views
Skip to first unread message

FlapJack

unread,
May 19, 2017, 2:54:17 PM5/19/17
to Joomla! General Development
Can anyone shed some light on the extract() method...?

I'm wondering why it needs to JLoader::register the admin helper file of my extension.

It's very possible I'm not doing things correctly in my extension, I have a helper file for the front-end (components/com_myextension/helpers/myextension.php) and a helper file for the admin side (administrator/components/com_myextension/helpers/myextension.php).
Both are called the same and have a class of the same name (JHTMLMyextension) - when the editor is displayed in the front-end and the field button is published the JHTML class in my helper gets redeclared because of of the extract() method.
The extension has already declared the JHTML class for my site helper file and then along comes the FieldsHelper::extract() method and registers the helper file from my admin side when I use the editor and the button plugin fires.

I know the simple answer is to probably eliminate 1 of the 2 helper files, but I'm curious why it needs to load that helper file from my extension's admin side and what I might be placing in my helper file that it would need.
I'm assuming I need to understand the way com_fields (et al) works, but if anyone can comment briefly on this that'd be great.

Happy Joomla!-ing.
FlapJack.

FlapJack

unread,
May 23, 2017, 10:25:04 AM5/23/17
to Joomla! General Development
Bueller. Bueller. Anyone? Anyone?

Allon Moritz

unread,
May 23, 2017, 12:37:32 PM5/23/17
to joomla-de...@googlegroups.com
It's the validateSection function which gets called in your Helper.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-dev-general@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

B Steen

unread,
May 27, 2017, 5:00:51 AM5/27/17
to joomla-de...@googlegroups.com
Okay, fair enough. I appreciate the reply.

But why?
What's it for and where can I find some information about it?

Thanks!
FlapJack
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send email to joomla-de...@googlegroups.com.

Allon Moritz

unread,
May 27, 2017, 3:56:17 PM5/27/17
to joomla-de...@googlegroups.com
Because the views on the front do have a different name than on the back end, this function does basically translate that context. At the moment there is no documentation, but the code is easy. Relevant code is here https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_fields/helpers/fields.php#L47

On Sat, May 27, 2017 at 11:00 AM, B Steen <stee...@gmail.com> wrote:
Okay, fair enough. I appreciate the reply.

But why?
What's it for and where can I find some information about it?

Thanks!
FlapJack

On May 23, 2017, at 11:37 AM, Allon Moritz <allon....@gmail.com> wrote:

It's the validateSection function which gets called in your Helper.
On 23 May 2017 16:25, "FlapJack" <stee...@gmail.com> wrote:
Bueller. Bueller. Anyone? Anyone?

On Friday, May 19, 2017 at 1:54:17 PM UTC-5, FlapJack wrote:
Can anyone shed some light on the extract() method...?

I'm wondering why it needs to JLoader::register the admin helper file of my extension.

It's very possible I'm not doing things correctly in my extension, I have a helper file for the front-end (components/com_myextension/helpers/myextension.php) and a helper file for the admin side (administrator/components/com_myextension/helpers/myextension.php).
Both are called the same and have a class of the same name (JHTMLMyextension) - when the editor is displayed in the front-end and the field button is published the JHTML class in my helper gets redeclared because of of the extract() method.
The extension has already declared the JHTML class for my site helper file and then along comes the FieldsHelper::extract() method and registers the helper file from my admin side when I use the editor and the button plugin fires.

I know the simple answer is to probably eliminate 1 of the 2 helper files, but I'm curious why it needs to load that helper file from my extension's admin side and what I might be placing in my helper file that it would need.
I'm assuming I need to understand the way com_fields (et al) works, but if anyone can comment briefly on this that'd be great.

Happy Joomla!-ing.
FlapJack.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsubscribe@googlegroups.com.

To post to this group, send email to joomla-dev-general@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-general+unsub...@googlegroups.com.
To post to this group, send email to joomla-dev-general@googlegroups.com.
Visit this group at https://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages