?
avatar Sepremex
Sepremex
22 Jun 2021

Issue

I need to overwrite the article form(there is not editing in frontend only backend), for this custom fields there is an specific data to be capture which depends one the information from other inputs plus the information needs to be save as json.

Expected result

When the overwrite is apply the new/edit article form should show a new tab with a collection of inputs that some of them are dynamic, if user need to add more of those inputs there should be a button to add more, each set of inputs depends of previews selections.

Actual result

When modifying the /administrator/component/com_content/models/forms/article.xml everything works as intended, but as you know there should be no modifications to the core components.

I have try to do an overwrite in: administrator/templates/mytemplate/html/com_content but nothing seems to work, from that path I have try with: models/forms/article.xml /core/modes/article/article.xml ... and a whole bunch and nothing works.

I'm not able to override the admin component specifically the article.xml file.

Frontend overrides not problem at all, but backend overrides seems to be impossible or atleaset not in the way that this article is saying

System information (as much as possible)

Joomla 3.9.27

No extra plugins

No extra components

No extra modules.

Additional comments

The installation is raw Joomla CMS, no plugins, modules, or anything from third parties, just plain Joomla 3 with a bunch of template overrides and custom API that does not interact with the core functionality until this request where I need to override the core/admin component.


So, to make an override for the administrator component specifically the article form where or how my path needs to be?

Thank you.

avatar Sepremex Sepremex - open - 22 Jun 2021
avatar joomla-cms-bot joomla-cms-bot - change - 22 Jun 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 22 Jun 2021
avatar brianteeman
brianteeman - comment - 22 Jun 2021

I dont believe this can be done by creating an xml file in site or admin

avatar Sepremex
Sepremex - comment - 22 Jun 2021

I dont believe this can be done by creating an xml file in site or admin

In fact it is not, yet not entirely true, I've been playing with this issue since yesterday morning, until a few minutes ago, by following a very old link(2014) it lead me to a plugin which allows you to make this kind of overrides.

So by redoing the old plugin and installing it, now I can make the xml override as I needed.

defined('_JEXEC') or die('Restricted index access');

class plgSystemForm_xml_override extends JPlugin {

 public function onAfterRoute() {
	$app = JFactory::getApplication();
	$DS = DIRECTORY_SEPARATOR;
	if ($app->isAdmin()){
	 $admin_path = JPATH_ADMINISTRATOR . $DS . 'templates' . $DS . $app->getTemplate() . $DS . 'backend/';
	 $com_str = $this->params->get('admin_com_name');
	 if($com_str==''){return;}
	 $com_array = explode(',',$com_str);
	 $option =$app->input->get('option');
	 if(in_array($option,$com_array)){
		jimport( 'joomla.form.form' );
		$form_path = JPATH_SITE . $DS .'administrator' . $DS . 'components' . $DS . $option . $DS . 'models/forms';
		JForm::addFormPath($form_path);
		JForm::addFormPath($admin_path . $option);
	 }
     }
 }

That is my plugin, and now I can put my override in
administrator/templates/My_Template/backend/com_toOverride/the_file.xml
and that is working as I needed. :)

avatar richard67
richard67 - comment - 23 Jun 2021

@Sepremex Can this issue be closed now as you have found a solution?

avatar Sepremex
Sepremex - comment - 23 Jun 2021

Yes, it can be closed, thank you. -------- Original message --------From: Richard Fath @.>Date: Wed, Jun 23, 2021, 1:13 AMTo: joomla/joomla-cms @.>Cc: Sepremex @.>, Mention @.>Subject: Re: [joomla/joomla-cms] Overwrite admin component form (#34603)
@Sepremex Can this issue be closed now as you have found a solution?

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.

avatar richard67 richard67 - close - 23 Jun 2021
avatar richard67
richard67 - comment - 23 Jun 2021

Closing as stated in previous comment.

avatar richard67 richard67 - change - 23 Jun 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-06-23 06:32:32
Closed_By richard67

Add a Comment

Login with GitHub to post a comment