Welcome, Guest
Username: Password: Remember me

TOPIC: [ADDED] FORK functionality for forms

ADD FORK functionality for forms 13 Jun 2013 08:17 #7455

  • Tomaselli
  • Tomaselli's Avatar
  • Online
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
Hi Admin,
the builder 2.5 is FANTASTIC, the fork feature works great, I know there are few bugs, but it's matter of time, all will be fixed.

I saw the XML files for forms are not included in the great FORK feature, so here my way to do it:

added in the classes item.php file.
	protected function preprocessForm(JForm $form, $data, $group = 'content'){		
		$baseFolder = JPATH_COMPONENT . '/fork/models/forms/';
		$formFile = $baseFolder . $this->view_item .'.xml';
		if (file_exists($formFile))
		{		
			$xml = simplexml_load_file($formFile);
			$form->load($xml, true);			
		}
		
		parent::preprocessForm($form, $data, $group);
	}

Surely there are other ways to do it, but this was the first I thought and it's clean and perfectly working.
So in this way, the fork xml file, is parsed against the original xml form file, if there are same fields, they are replaced by the fork file, otherwise they are added :) .

this is a good option if we wanna add new fields in the form (but they need to be processed "before save" and on "getItem") for the "Object (JSON)" field.
thank you for your work.
The administrator has disabled public write access.
The following user(s) said Thank You: admin

Re: ADD FORK functionality for forms 17 Jun 2013 07:24 #7507

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Super cool !!
Will dig in.

Thank you so much for this proposal. Amazing.
K++;

I know, working with forks means also workin with much more files, but it works good and it is a time cutter.
Coding is now a piece of cake
The administrator has disabled public write access.

Re: ADD FORK functionality for forms 18 Jun 2013 05:18 #7537

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 278
  • Thank you received: 35
  • Karma: 22
I tested farer the new FORK system.

I 've just modify the files :
- fork/views/cpanel/view.html.php,
- fork/views/cpanel/tmpl/default.php,

works fine :)

Object : cpanel customization.
A great addon in this new version !
The administrator has disabled public write access.

Re: ADD FORK functionality for forms 24 Jun 2013 13:33 #7626

  • admin
  • admin's Avatar
  • Online
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Added in features.

@Tomaselli : Super Thanks.

I have changed only two things. Your code is good !

www.j-cook.net/index.php/docs/versions/77-2-5-3
Coding is now a piece of cake
The administrator has disabled public write access.

Re: ADD FORK functionality for forms 24 Jun 2013 13:44 #7629

  • Tomaselli
  • Tomaselli's Avatar
  • Online
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
thanks to you to have added it! and for your hard work! :)
The administrator has disabled public write access.
Time to create page: 0.089 seconds

Get Started