Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

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

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 following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

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

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
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 !

Please Log in or Create an account to join the conversation.

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

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
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

Please Log in or Create an account to join the conversation.

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

thanks to you to have added it! and for your hard work! :)

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.066 seconds

Freakin' Awesome!!! J-Cook is simply awesome - whether you're a highly experienced developer or complete novice whether you're building a small inventory component or a complete community solution! The beauty comes from a fast slick and reliable platform that readily provides developers with everything they'll need to build the backbone of a solid and secure component with wizards for authoring access publishing aliasing created/modified by dates... you name it COOK provides it! J-Cook really surpasses all of the 'competition' as far as MVC tools are concerned! Try love it and get cooking!
learnthrusong (JED)
          

Get Started