1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Controller->responseMessage as Subview

Discussion in 'XenForo Development Discussions' started by xf_phantom, Dec 2, 2013.

  1. xf_phantom

    xf_phantom Well-Known Member

    Can i cast the response from responseMessage to use it XenForo_ControllerResponse_View ?:D

    I want to send a message inside the account pages(which are using using XenForo_ControllerHelper_Account->getWrapper which requires the 3. parameter to be XenForo_ControllerResponse_View )

    that's why i'll get an error if i'll use only "$this->responseMessage('..');
  2. xf_phantom

    xf_phantom Well-Known Member

    nobody? :(
  3. Chris D

    Chris D XenForo Developer Staff Member

    I just don't think it's possible, unfortunately. (And I think you posted about this once before).

    It would more than likely create less effort to simply create a template and render it as a view.

    Or, if you are potentially going to have lots of these cases where you need to pass a message, you could create a template that accepts a single view param called {$errorMessage}

    $subView $this->responseView('Your_AddOn_ViewPublic_Error''your_addon_error_message', array('errorMessage' => new XenForo_Phrase('an_error_message')));
    You could then re-use that at your leisure, just changing the error each time.
    xf_phantom likes this.
  4. xf_phantom

    xf_phantom Well-Known Member


    Current solution:

    class FAT_Core_Helper_Account extends XenForo_ControllerHelper_Account{

        public function 
    responseMessageOnAccountPage($selectedGroup$selectedLink$message$alternativeViewName 'FOO'$altnativeMessageTemplate 'fat_core_message'){
    $subView $this->_controller->responseView($alternativeViewName$altnativeMessageTemplate, array('msg' => $message));
  5. xf_phantom

    xf_phantom Well-Known Member

    And usage

    public function actionIndex()
    $visitor XenForo_Visitor::getInstance()->toArray();
            if (
    $this->_getModel()->isAlreadyVerified(XenForo_Visitor::getInstance()->toArray())) {
    //TODO http://xenforo.com/community/posts/678062/
            else if (

    $subView $this->responseView('FAT_X''fat_uservalidation_form');



Share This Page