Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Forking the xml in the model/forms folder and JDom

Forking the xml in the model/forms folder and JDom 03 Oct 2013 06:58 #11291

  • VeCrea
  • VeCrea's Avatar
  • Offline
  • Platinum Member
  • Absolute JCook fan
  • Posts: 473
  • Thank you received: 100
  • Karma: 30
Would it be possible ?
Thanks,
V.
The administrator has disabled public write access.

Forking the xml in the model/forms folder and JDom 10 Oct 2013 00:06 #11360

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
It is possible to fork them now, but only limited to add or modify existing fields.
You cannot remove a field from XML.
You can eventually set it to hidden, but not the cleanest.

Limitations are for the others XML files (config, layout, ...)
Coding is now a piece of cake
The administrator has disabled public write access.

Forking the xml in the model/forms folder and JDom 19 Oct 2013 21:51 #11419

  • rnevins
  • rnevins's Avatar
  • Offline
  • Junior Member
  • Posts: 24
  • Thank you received: 6
  • Karma: 1
I think there may be a bug when you have a radio type field in a forked xml.

The preprocessForm method is calling the $form->load method which is removing the radio fields.

Here is the calling code: (in classes/model/item.php)
$baseFolder = JPATH_COMPONENT .DS. 'fork' .DS. 'models' .DS. 'forms';
$formFile = $baseFolder .DS. $this->view_item .'.xml';
if (file_exists($formFile))
{
$xml = simplexml_load_file($formFile);
$form->load($xml, true);
}
The administrator has disabled public write access.

Forking the xml in the model/forms folder and JDom 29 Nov 2013 00:16 #11707

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
I got it.

This is a problem in Joomla.

You must hack a line:
libraries/joomla/forms/forms.php - LINE 723
$olddom = dom_import_simplexml($current);
$loadeddom = dom_import_simplexml($field);

//HERE FIX JOOMLA ISSUE
//-$addeddom = $olddom->ownerDocument->importNode($loadeddom);
$addeddom = $olddom->ownerDocument->importNode($loadeddom, true);
//
$olddom->parentNode->replaceChild($addeddom, $olddom);
$loadeddom->parentNode->removeChild($loadeddom);
Coding is now a piece of cake
The administrator has disabled public write access.

Forking the xml in the model/forms folder and JDom 05 Jan 2014 21:29 #11914

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 987
  • Karma: 140
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: JoomGuy
Time to create page: 0.133 seconds

Get Started