Jump to content

Content::edit() doesn't let you use custom template forms


teraßyte

Recommended Posts

Posted

Can you please change the method \IPS\Content\Controller::edit() to allow the use of custom templates to display the edit form? Right now the code is this:

			/* Build the form */
			$form = $item->buildEditForm();

			if ( $values = $form->values() )
			{
						/* [...] */
			}
			
			$this->_setBreadcrumbAndTitle( $item );
			\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'forms', 'core' )->editContentForm( \IPS\Member::loggedIn()->language()->addToStack( 'edit_title', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $item::$title ) ) ) ), $form );

You allow us to add/change fields in the buildEditForm() method but we still can't choose a custom template. I had to copy/paste the whole function just to be able to use this line:

\IPS\Output::i()->output  = $form->customTemplate( array( call_user_func_array( array( \IPS\Theme::i(), 'getTemplate' ), array( 'MODULE', 'APP' ) ), 'TEMPLATE' ), $arguments );

 

Posted

You can also do a theme hook on editContentForm and overload the function itself (in PHP mode). You could check the current app and controller and just return different output if it meets your criteria.

It's helpful that the form is passed in as an object instead of being converted to a string.

Posted

Indeed, but I don't want to make an hook each time I want to add a specific template for an edit form. If they let us somehow specify the template in the $form class itself and it gets used when the __toString function in the class is called it would be much more convenient. Not to mention this would "fix" all the other forms too making it available globally and easily :p

  • 1 month later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...