Create a status field, enable filtering and remove unpublished from list.
<field
name="published"
type="status"
label="JOPTION_SELECT_PUBLISHED"
filter="1,2,-2,*"
description="JOPTION_SELECT_PUBLISHED_DESC"
onchange="this.form.submit();"
>
<option value="">JOPTION_SELECT_PUBLISHED</option>
</field>
Unpublished should be removed.
Unpublished is still present.
Joomla 3.9.15
PHP 7.3.2
Issue is in JFormFieldPredefinedList where the in_array will always return true on 0.
Labels |
Added:
?
|
In my own component. But I like to use Joomla native code.
It' a list of affiliates but they should only be able to be published, archived, trashed.
Either way there is a filter function on the status field or JFormFieldPredefinedList that is not working with 0.
It must be an issue in your code because clearly we use that everywhere in Joomla
Status | New | ⇒ | Confirmed |
I can confirm this issue.
so how does it work in core?
As far as I know (but I might be wrong, so correct me if so), the "filter" is applied at form validation, i.e. it has no impact on which options are shown but only on which options are being accepted on validation.
@brianteeman We don't use this field with the values required to run into the issue. But it's totally valid issue. The closest we have in core is this:
If you remove 0
from the list and view the dropdown, Unpublished
option will still be listed.
@richard67 Right, we have conflicting attributes here. That's another issue. Needs to be solved before 4.0.
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-02-24 20:15:23 |
Closed_By | ⇒ | alikon |
Where are you using this?