Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted August 17, 20168 yr 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 );
August 18, 20168 yr 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.
August 18, 20168 yr Author 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
October 3, 20168 yr I have raised the suggestion internally for further review and discussion, thanks!
Archived
This topic is now archived and is closed to further replies.