Override of article edit layout

Everything to do with Joomla! 3.x templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Windows Defender SmartScreen Issues <-- please read this if using Windows 10.
Post Reply
User avatar
rbuelund
Joomla! Guru
Joomla! Guru
Posts: 770
Joined: Sat Feb 10, 2007 9:07 pm
Location: Århus
Contact:

Override of article edit layout

Post by rbuelund » Tue Jun 22, 2021 7:12 pm

I can override edit.php, by putting it in /templatename/html/com_content/form/
but what if I have an article layout override called myoverride.php - how do I create different layouts for the edit view - is that not possible ??
I have tried /mytemplate/html/com_content/form/myoverride_edit.php - but it still uses the edit.php file when editing an article ??
Ronny Buelund
Coordinator of the Danish Joomla Translation Team: http://danskjoomla.dk
Owner of http://ableit.dk

illovo
Joomla! Intern
Joomla! Intern
Posts: 82
Joined: Sun Jan 13, 2013 9:30 am
Contact:

Re: Override of article edit layout

Post by illovo » Tue Jun 22, 2021 7:22 pm

Never use underscores in an override file if it's not part of a group like
thing.php
thing_links.php
thing_articles.php

Underscores are reserved for subtemplates/sublayouts of thing.php.

illovo
Joomla! Intern
Joomla! Intern
Posts: 82
Joined: Sun Jan 13, 2013 9:30 am
Contact:

Re: Override of article edit layout

Post by illovo » Tue Jun 22, 2021 7:37 pm

But that's not the whole answer:
There's no field to select you custonm override in menu items of type "Create article".
Therefore you must create your own menu item.
- Copy edit.php and edit.xml to the override folder as myedit.php and myedit.xml or whatever name you like.
- Adapt the xml file like this

Code: Select all

<layout title="COM_CONTENT_FORM_VIEW_MYEDIT_TITLE" option="COM_CONTENT_FORM_VIEW_MYEDIT_OPTION">
	<message>
		<![CDATA[COM_CONTENT_FORM_VIEW_MYEDIT_DESC]]>
	</message>
</layout>
Afterwards you can select your custom layout "COM_CONTENT_FORM_VIEW_MYEDIT_TITLE" in field "Menu Item Type". The rest is to create language strings.

User avatar
rbuelund
Joomla! Guru
Joomla! Guru
Posts: 770
Joined: Sat Feb 10, 2007 9:07 pm
Location: Århus
Contact:

Re: Override of article edit layout

Post by rbuelund » Tue Jun 22, 2021 7:47 pm

But I need the override for edit (frontend) to be another than that for create (frontend) ?? Is that not possible to achieve ?
Ronny Buelund
Coordinator of the Danish Joomla Translation Team: http://danskjoomla.dk
Owner of http://ableit.dk

User avatar
rbuelund
Joomla! Guru
Joomla! Guru
Posts: 770
Joined: Sat Feb 10, 2007 9:07 pm
Location: Århus
Contact:

Re: Override of article edit layout

Post by rbuelund » Wed Jun 23, 2021 4:18 am

Sorry - wrong what i wrote in the recent post. The problem is, that if I create an article frontend with my layout override myoverride.php, then when I want to edit the article, the layout is not used, but instead edit.php.
I can also se it in the edit link:

Code: Select all

https://xxxxxx.dk/nyheder?view=form&layout=edit&a_id=8&catid=11&return=aHR0cHM6Ly9rcm10ZXN0Lm92ZWxzZS5kay9ueWhlZGVyLzgtZGV0dGUtZXItZW4tYXJ0aWtlbC1tZXJl
The part saying layout=edit, should say layout=myoverride - how to do that ??
Ronny Buelund
Coordinator of the Danish Joomla Translation Team: http://danskjoomla.dk
Owner of http://ableit.dk

illovo
Joomla! Intern
Joomla! Intern
Posts: 82
Joined: Sun Jan 13, 2013 9:30 am
Contact:

Re: Override of article edit layout

Post by illovo » Wed Jun 23, 2021 10:00 am

I haven't tested it but maybe with a custom plugin and code like this:
https://github.com/nielsnuebel/plg_syst ... hp#L38-L41
The plugin redirects article edit calls to another template, normally Protostar.

Instead of changing the "templateStyle" change the "layout" parameter(????)

Or use the plugin like it is and redirect to another template (copy) where you have a customized override of edit.php.

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 40107
Joined: Sat Apr 05, 2008 9:58 pm

Re: Override of article edit layout

Post by Webdongle » Wed Jun 23, 2021 11:07 pm

Are you trying to create a 'Layout override' that you can choose from within a Component, Module etc? https://docs.joomla.org/J3.x:Layout_Overrides_in_Joomla
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
rbuelund
Joomla! Guru
Joomla! Guru
Posts: 770
Joined: Sat Feb 10, 2007 9:07 pm
Location: Århus
Contact:

Re: Override of article edit layout

Post by rbuelund » Thu Jun 24, 2021 4:14 am

Yes, but for the /form/edit.php file - which is not described on the page you refer to. I need the edit button of an article to redirect to this new layout - which it does not do.
Ronny Buelund
Coordinator of the Danish Joomla Translation Team: http://danskjoomla.dk
Owner of http://ableit.dk

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 40107
Joined: Sat Apr 05, 2008 9:58 pm

Re: Override of article edit layout

Post by Webdongle » Thu Jun 24, 2021 8:18 am

A 'Layout override' is selected in a menu item edit page or in an extension edit page.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
rbuelund
Joomla! Guru
Joomla! Guru
Posts: 770
Joined: Sat Feb 10, 2007 9:07 pm
Location: Århus
Contact:

Re: Override of article edit layout

Post by rbuelund » Thu Jun 24, 2021 8:22 am

The override must work when you view the article frontend and press the edit icon - that is the problem. And only for articles in a certain cetagory.
Ronny Buelund
Coordinator of the Danish Joomla Translation Team: http://danskjoomla.dk
Owner of http://ableit.dk

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 40107
Joined: Sat Apr 05, 2008 9:58 pm

Re: Override of article edit layout

Post by Webdongle » Thu Jun 24, 2021 9:20 am

That is not a 'Layout override' or 'Template override' that you need. You need to change the layout of the editor itself. With JCE editor you can define the edit icons per User Group. To change it per Article you would probably need to make sure the Articles were in the same Category ... and create an override for the editor component with some sort of IF statement.

'Layout Overrides' can be selected in menu items. To create a layout override first create a 'Template Override' then turn it into a 'Layout override' by creating an xml file. You can then select the 'Layout Override' by menu item. But I doubt an Override of the edit Screen of the Article Component will change the layout of the Editor Component.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".


Post Reply

Return to “Templates for Joomla! 3.x”