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
Conversation
Wasn't this as a result of JSST @SniperSister @zero-24 |
Yes. See edited first comment. |
Thank you! |
filter not making sense: maybe the filter should only be visible if editor or textarea is selected. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25189. |
New commit contains:
Code style OK??? I hate too long lines ;-) |
@BPBlueprint @lunalars Normally I lose interest after 1 or 2 months in my prs and fixing branch conflicts ;-) if I don't use features myself. |
If I set fieldtype to "Editor" and filter to "Use settings from Plugin" the HTML tags are still removed - should it be like this? This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25189. |
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. |
Yes, you're right. Sorry, then I have to give up here without assistance of others. |
Can "Use settings from Plugin" be removed here? |
Give it a try! ;-) I removed global setting "Use settings from plugin". |
very nice :-) |
the mentioned warning appears on editing an article |
I have tested this item ✅ successfully on 1824077 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. |
I have tested this item ✅ successfully. I have tested text, textarea and editor with and without filters. |
Status "Ready To Commit". |
thx |
Thank you, guys! |
@@ -65,6 +65,11 @@ public function onCustomFieldsPrepareDom($field, DOMElement $parent, JForm $form | |||
$child->addAttribute('name', $formField->fieldname); | |||
$child->addAttribute('type', $formField->fieldtype); | |||
$child->addAttribute('readonly', $readonly); | |||
|
|||
if (isset($formField->fieldfilter)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ReLater
As @bembelimen told me there seems to be to problems in this PR, first why do you set JNO to "0"?
And isset($formField->fieldfilter) will in this case always be true.
I would suggest to set JNO to value="" and change isset() to !empty() also I think you have to cast it to (string) and maybe better compare it to !== ''.
No. If you select type Media then fieldfilter is not set/is undefined and that was the reason for this line because you get a warning. JNO=0 comes from the params that you can find in the params.xml of the plugins for single fields. E.g. For me the question is: What effect should filter="0" have? Really no filtering (="unset"), fall back to "string" ... ? I don't know. value="" was removed because it doesn't work. You can test that by setting a filter in the com_fields editor plugin. It's ignored in the repeatable field if you set "COM_FIELDS_FIELD_USE_GLOBAL". TBH I never use com_fields and just provided this pr because we have submitted the security issue then and forgot to test com_fields repeatable and wanted to help concerned users quickly. @bembelimen can provide and describe a corrective pr if he thinks that something doesn't work here as expected. |
That's really strange but if it works it's ok for me. thx |
Pull Request for Issue #25187
Summary of Changes
subform
child fields are validated. So a minimum validation happens like known from "normal" form fields if nofilter
attribute is set for them.repeatable
field uses asubform
HTML tags are removed e.g. from editor or textarea contents during validation. This PR adds a filter field to any subfield row ofrepeatable
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
orNumber
: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