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

[com_fields] Field type Repeatable. Editor and Textarea subfields remove HTML since J 3.9.7 #25189

Merged
merged 7 commits into from Jun 14, 2019

Conversation

Projects
None yet
10 participants
@ReLater
Copy link
Contributor

commented Jun 12, 2019

Pull Request for Issue #25187

Summary of Changes

  • Since Joomla 3.9.7 subform child fields are validated. So a minimum validation happens like known from "normal" form fields if no filter attribute is set for them.
  • Because the com_fileds repeatable field uses a subform HTML tags are removed e.g. from editor or textarea contents during validation. This PR adds a filter field to any subfield row of repeatable fields.

Testing Instructions

  • Create a new com_fields field for Articles of type repeatable .

  • Add a subfield of type Editor.

  • Edit an article and enter some paragraphs in that editor.

  • Save the article => paragraphs removed.

  • Apply patch.

  • Open above field.

  • You'll see a new filter field for any row but for rows with type Media or Number:

12-06-_2019_15-48-04

  • Set Filter "Text" or "Safe Html."

  • Save field.

  • Open and edit article again or use a new one and enter some paragraphs => Save article => paragraphs NOT removed.

  • Test if filters are applied and work as expected for any field types.

  • The filter options change depending on your selection in Type

@brianteeman

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

Wasn't this as a result of JSST @SniperSister @zero-24

@ReLater

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

Wasn't this as a result of JSST @SniperSister @zero-24

Yes. See edited first comment.

@alikon

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

How can I convert a draft pr to a regular one on GitHub????

just click on ready for review

image

@ReLater ReLater marked this pull request as ready for review Jun 12, 2019

@ReLater

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

just click on ready for review

Thank you!

@ReLater ReLater changed the title Repeatable custom field: Editor and Textarea fields always filter HTML since J 3.9.8 [com_fields] Field type Repeatable. Editor and Textarea subfields fields remove HTML since J 3.9.7 Jun 12, 2019

@ReLater ReLater changed the title [com_fields] Field type Repeatable. Editor and Textarea subfields fields remove HTML since J 3.9.7 [com_fields] Field type Repeatable. Editor and Textarea subfields remove HTML since J 3.9.7 Jun 12, 2019

@lunalars

This comment has been minimized.

Copy link
Contributor

commented Jun 12, 2019

filter not making sense: maybe the filter should only be visible if editor or textarea is selected.
added your code manually and also added showon="fieldtype:editor[OR]fieldtype:textarea to fieldfilter and did some quick tests. seems to work for all selected fieldtypes.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25189.

@ReLater

This comment has been minimized.

Copy link
Contributor Author

commented Jun 12, 2019

New commit contains:

  • Added more filter options. Taken over from single field types text and textarea.
  • Added showon to filterfield (hide if media or number)
  • Added showon to options.

Code style OK??? I hate too long lines ;-)

@ReLater

This comment has been minimized.

Copy link
Contributor Author

commented Jun 13, 2019

@BPBlueprint @lunalars
Could you please test this pr and mark your tests unsuccessful or successful on https://issues.joomla.org/tracker/joomla-cms/25189 . It's easy to apply and remove the patch with extension "Joomla! Patch Tester".

Normally I lose interest after 1 or 2 months in my prs and fixing branch conflicts ;-) if I don't use features myself.

@lunalars

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

If I set fieldtype to "Editor" and filter to "Use settings from Plugin" the HTML tags are still removed - should it be like this?
other settings work just fine.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25189.

@lunalars

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

Sorry, forgot to mention: in the Editor Plugin (fields) Filter is set to "Text", so tags should not be removed.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25189.

@ReLater

This comment has been minimized.

Copy link
Contributor Author

commented Jun 13, 2019

Sorry, forgot to mention: in the Editor Plugin (fields) Filter is set to "Text", so tags should not be removed.

Yes, you're right.
Set in plugin "Fields - Editor" filter to "Text".
In custom repeatable field select Editor and set filter to "Use settings from plugin".
Setting is not respected.
(Added as "Known bug" to intro comment.)

Sorry, then I have to give up here without assistance of others.

@lunalars

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

Can "Use settings from Plugin" be removed here?
I think it's not clear wich settings are meant: from editor or repeatable plugin.

@ReLater

This comment has been minimized.

Copy link
Contributor Author

commented Jun 13, 2019

Can "Use settings from Plugin" be removed here?

Give it a try! ;-) I removed global setting "Use settings from plugin".

@lunalars

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

very nice :-)
One more: I get SimpleXMLElement::addAttribute(): Attribute already exists in plugins/fields/repeatable/repeatable.php on line 72
child attribute is already set on line 66

@lunalars

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

the mentioned warning appears on editing an article

@lunalars

This comment has been minimized.

Copy link
Contributor

commented Jun 13, 2019

I have tested this item successfully on 1824077

With the latest code selected filters work as expected. Tested all filters for text, textarea and editor.

The warning was gone after applying the latest patch correctly.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25189.

@BPBlueprint

This comment has been minimized.

Copy link

commented Jun 14, 2019

I have tested this item successfully.

I have tested text, textarea and editor with and without filters.
Works as expected.

@franz-wohlkoenig

This comment has been minimized.

Copy link
Member

commented Jun 14, 2019

Status "Ready To Commit".

@joomla-cms-bot joomla-cms-bot added the RTC label Jun 14, 2019

@HLeithner HLeithner merged commit a62756b into joomla:staging Jun 14, 2019

3 of 5 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
JTracker/HumanTestResults Human Test Results: 1 Successful 0 Failed.
Details
Hound No violations found. Woof!
continuous-integration/drone/pr Build is passing
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@joomla-cms-bot joomla-cms-bot removed the RTC label Jun 14, 2019

@HLeithner

This comment has been minimized.

Copy link
Member

commented Jun 14, 2019

thx

@HLeithner HLeithner added this to the Joomla 3.9.9 milestone Jun 14, 2019

@ReLater ReLater deleted the ReLater:patch-1 branch Jun 14, 2019

@ReLater

This comment has been minimized.

Copy link
Contributor Author

commented Jun 14, 2019

Thank you, guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.