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
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions plugins/fields/repeatable/params/repeatable.xml
Expand Up @@ -30,6 +30,39 @@
<option value="text">PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_TEXT</option>
<option value="textarea">PLG_FIELDS_REPEATABLE_PARAMS_FIELDNAME_TYPE_TEXTAREA</option>
</field>
<field
name="fieldfilter"
type="list"
label="PLG_FIELDS_TEXT_PARAMS_FILTER_LABEL"
description="PLG_FIELDS_TEXT_PARAMS_FILTER_DESC"
class="btn-group"
validate="options"
showon="fieldtype!:media,number"
>
<option value="">COM_FIELDS_FIELD_USE_GLOBAL</option>
<option value="0">JNO</option>
<option
showon="fieldtype:editor,text,textarea"
value="raw">JLIB_FILTER_PARAMS_RAW</option>
<option
showon="fieldtype:editor,text,textarea"
value="safehtml">JLIB_FILTER_PARAMS_SAFEHTML</option>
<option
showon="fieldtype:editor,text,textarea"
value="JComponentHelper::filterText">JLIB_FILTER_PARAMS_TEXT</option>
<option
showon="fieldtype:text,textarea"
value="alnum">JLIB_FILTER_PARAMS_ALNUM</option>
<option
showon="fieldtype:text,textarea"
value="integer">JLIB_FILTER_PARAMS_INTEGER</option>
<option
showon="fieldtype:text,textarea"
value="float">JLIB_FILTER_PARAMS_FLOAT</option>
<option
showon="fieldtype:text,textarea"
value="tel">JLIB_FILTER_PARAMS_TEL</option>
</field>
</fieldset>
</fields>
</form>
Expand Down
5 changes: 5 additions & 0 deletions plugins/fields/repeatable/repeatable.php
Expand Up @@ -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);

ReLater marked this conversation as resolved.
Show resolved Hide resolved
if (isset($formField->fieldfilter))
Copy link
Member

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 !== ''.

{
$child->addAttribute('filter', $formField->fieldfilter);
}
}

$fieldNode->setAttribute('formsource', $fieldsXml->asXML());
Expand Down