Skip to content

[6.2] Add Enum FormField - #48113

Merged
MacJoom merged 3 commits into
joomla:6.2-devfrom
Hackwar:6.2-enum-field
Aug 10, 2026
Merged

[6.2] Add Enum FormField#48113
MacJoom merged 3 commits into
joomla:6.2-devfrom
Hackwar:6.2-enum-field

Conversation

@Hackwar

@Hackwar Hackwar commented Jul 17, 2026

Copy link
Copy Markdown
Member
  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

This adds a new FormField which populates its options from a PHP Enum.

Testing Instructions

Add the following enum in /administrator/components/com_content/src/Enum/StateType.php

<?php 
namespace Joomla\Component\Content\Administrator\Enum;
enum StateType: int
{
    case Published           = 1;
    case Archived              = 2;
}

Add the following in line 275 of /administrator/components/com_content/forms/article.xml

        <field name="teststatus" type="enum" enum="Joomla\Component\Content\Administrator\Enum\StateType"
               prefix="COM_CONTENT_ARTICLES_STATE_OPTION" label="COM_CONTENT_ARTICLES_STATE_OPTION_STATE_TYPE_LABEL"
               default="0">
            <option value="0">COM_CONTENT_ARTICLES_STATE_OPTION_NONE</option>
        </field>

Actual result BEFORE applying this Pull Request

The field doesn't exist.

Expected result AFTER applying this Pull Request

The new field is displayed with 3 entries.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@Reda-Muhamed

Copy link
Copy Markdown

I have tested this item ✅ successfully on b860c87


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

1 similar comment
@LadySolveig

Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on b860c87


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

@QuyTon

QuyTon commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

RTC


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

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jul 20, 2026
@laoneo

laoneo commented Jul 23, 2026

Copy link
Copy Markdown
Member

I would say, that this needs to be documented, or not?

@MacJoom
MacJoom merged commit 6118d14 into joomla:6.2-dev Aug 10, 2026
56 checks passed
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 10, 2026
@MacJoom MacJoom added this to the Joomla! 6.2.0 milestone Aug 10, 2026
@MacJoom

MacJoom commented Aug 10, 2026

Copy link
Copy Markdown
Member

Thank you!

@MacJoom

MacJoom commented Aug 10, 2026

Copy link
Copy Markdown
Member

Documentation PR is here: joomla/Manual#696

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants