Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frontend article params #11907

Closed
Denitz opened this issue Sep 3, 2016 · 5 comments
Closed

Frontend article params #11907

Denitz opened this issue Sep 3, 2016 · 5 comments

Comments

@Denitz
Copy link
Contributor

Denitz commented Sep 3, 2016

Native Protostar template - no frontend article layout overrides:

Steps to reproduce the issue

Load form with <fields name="attribs"> custom fields via onContentPrepareForm event.
Edit article in frontend, no form fields are displayed

Load form with <fields name="params"> custom fields via onContentPrepareForm.
Edit article in frontend, form fields are displayed
Fill in fields and save article.
No data is saved.

Expected result

Custom <fields name="attribs"> are displayed and saved in frontend - same as in backend.

Actual result

Frontend does not display <fields name="attribs"> but <fields name="params"> which are not saved.

@Denitz
Copy link
Contributor Author

Denitz commented Sep 3, 2016

In other words:

backend displays both params and attribs fields.
frontend displays params fields only.
both frontend and backend save data from attribs fields only.

@Denitz Denitz closed this as completed Sep 3, 2016
@brianteeman
Copy link
Contributor

Why did you close this?

@Denitz Denitz reopened this Sep 3, 2016
@Denitz
Copy link
Contributor Author

Denitz commented Sep 3, 2016

Sorry, re-opened.

Yes, /components/com_content/view/form/tmpl/edit.php uses the code:

<?php foreach ($this->form->getFieldsets('params') as $name => $fieldSet) : ?>

So it displays params fields only, not attribs. But these params fields will be not saved since table uses attribs.

@n9iels
Copy link
Contributor

n9iels commented Sep 6, 2016

I can confirm this. Execpt for displaying custom fields, there is also a problem with saving.

Now it is impossible to create a plugin that save custom fields in the parameters for front- and back-end. The only way to do it now is creating a complete new fieldset and let the plugin save data in its own database table.
If you just want to add a simple custom text field this is overkill.

For the back-end you can do something like this:

<fieldset name="params">
    <field
        name="test"
        type="text"
        label="Text field"
        description="some text field"
    />
</fieldset>

The content of this field will be save inside the params row of the com_content table. Not sure way, but for the front-end you have to use a fieldset called attribs.

Note
I try to explain this as good as possible. If it is still not clear I can create a simple plugin to show the problem I have.

@brianteeman
Copy link
Contributor

As the description of the option states that it is only to display them on the admin I am going to close this as expected behaviour and as it is now two years old clearly everyone else thinks it is to be expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants