Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions plugins/fields/repeatable/params/repeatable.xml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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);

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