I want to change the Field type for the Article's Links, from input text to DropDown List with internal menu items. I am looking for a convenient way to do this with the minimum work.

I can't find anywhere if there is a way to create a simple override by placing the XML in another location. Is this possible anyhow ?

Otherwise, what would be the best approach?

3 Answers 3


The more standard approach would probably be to use a plugin to catch the JForm object after the XML has been processed but before it has left the model to make your changes. An example of that function would be like this:

function onContentPrepareForm($form, $data)
    if (!($form instanceof JForm))
        return false;

    // Check we are manipulating a valid form.
    $name = $form->getName();
    if (!in_array($name, array('com_content.article')))
        return true;


    return true;

loadFile by default has the $reset flag set to true, so if there are fields with the same name, it should replace them with the new version. This wouldn't work like a regex, so you would have to define the entire field, not just the new piece. However, it should be easy to maintain your separate file in a place that won't be affected by updates (like in the plugin folder!).

Also, if not obvious, it would be best to make this a content plugin.


the xml-overrides-plugin sounds neat( Form XML Override ). If I understand correctly you want to modify the urla - field in the , right? I think the easiest way is probably to use a sql-field-type instead of the menu-field-type ( SQL field type ). Your field definition could be something like this:

<fields name="urls" label="COM_CONTENT_FIELD_URLS_OPTIONS">
    <field name="urla" type="sql" validate="url"
    filter="url" label="COM_CONTENT_FIELD_URLA_LABEL"
    key_field="url" value_field="title"
    query="select concat('index.php?Itemid=', cast(id as char)) url, 
    concat(repeat('    ', (level-1)), menutype,'-',title) as title
    from #__menu where client_id=0 and id != 1 order by menutype, lft"
    ><option value="">-- Select internal menu --</option></field>

This will list all site menu items, and return an url to each menu item. This way the urla (or urlb or urlc) - field will get returned an accepted value.


I have found a plugin that does exactly this: Allows XML overrides. Plugin JED page is here: Form XML Override

But I am still looking for a custom way to go for this.


I tested the plugin and it works great. However my specific idea to replace the links text input field with a list of the available menu items, was not ideal, because the field does not save the type of data the menuitems list is providing. For this specific need I should do this differently.

  • How did you get this working? I've tried it but my XML doesn't get taken. I'm sure it's the way I've set it up but the instructions are a little unclear.
    – Eoin
    Commented Jun 2, 2021 at 12:58
  • 1
    That was ages ago. I don't even remember what it was about and where I used it. If I find a clew I will update you.
    – FFrewin
    Commented Jun 3, 2021 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.