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

TOPIC:

[ADDED] Custom Bricks 26 Jul 2012 10:03 #2902

  • arnar
  • arnar's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 20
  • Thank you received: 1
Hi,

I believe it would be useful to add the following bricks.
  1. Save & New. Works similar to Save & Close except it Saves and opens up a empty sheet.
  2. Save & Clone. Works similar to 1. except it Saves and opens up a copy of the Saved item with a new id.
  3. Custom Brick with label. Then once published the user could just call code from the brick action. It would make it easier to automatically replace code instead of having to manually change the files after publish.


Regards
Arnar
The following user(s) said Thank You: edwardcox

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

Last edit: by arnar.

Re: Custom Bricks 26 Jul 2012 12:47 #2907

+1 from me, I like the way he is thinking.

Edward.
Passionate Joomla! Developer and J-Cook pro evangelist.
www.jcombuilder.com - we build great Joomla!® Components so you don't have to.

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

Re: Custom Bricks 26 Jul 2012 16:48 #2908

  • arnar
  • arnar's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 20
  • Thank you received: 1
The save & new code is really simple

in view form add
if ($access->get('core.edit') || ($isNew && $access->get('core.create') || $access->get('core.edit.own')))
			$bar->appendButton( 'Standard', "save-new", "JTOOLBAR_SAVE_AND_NEW", "save2new", false);

then in controller add
in constructor
        $this->registerTask( 'save2new', 'save' );

in save function
        $task = $this->getTask();

      		if ($cid = parent::_save($post))
		{
			$vars = array();

            if ($task == 'save2new') {
                
                JRequest::setVar( 'cid', 0 );
                JRequest::setVar( 'view'  , 'clubitem');
                JRequest::setVar( 'layout', 'clubitem' );
            }
            else
            {
			    JRequest::setVar( 'view'  , 'clubs');
			    JRequest::setVar( 'layout', 'default' );
			    JRequest::setVar( 'cid', null );
            }
			$this->setRedirect(LpadHelper::urlRequest($vars));
		}
		else
			//Keep the post and stay on page
			parent::display();

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

Last edit: by arnar.
  • Page:
  • 1
Time to create page: 0.108 seconds

For starters it's just so easy to design an app in a way that I'm used to i.e. database first then views followed by customization. The fork system is pure brilliance from a developer standpoint as I can override things and still add and update my projects with minimal effort! Truly amazing to be able to build components in Joomla using incremental refinement without having to do everything by hand. Thanks for the great tool! I am so much more productive now than ever and I can't imagine building components any other way!!!!
Dave (Forum)

Get Started