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

Fixed [1.2 Beta 1] Debug mode controller name/action hint missing on subView pages

Discussion in 'Resolved Bug Reports' started by Jon W, Jun 23, 2013.

  1. Jon W

    Jon W Well-Known Member

    In XenForo_Dependencies_Abstract:: preRenderView in XenForo 1.2.0 Beta 1, the last bit of code was changed from:
    PHP:
    if ($controllerResponse)
    {
        
    $this->_defaultTemplateParams['controllerName']  = $controllerResponse->controllerName;
        
    $this->_defaultTemplateParams['controllerAction'] = $controllerResponse->controllerAction;
        
    $this->_defaultTemplateParams['viewName'] = $controllerResponse->viewName;
    }
    to:
    PHP:
    if ($controllerResponse)
    {
        if (
    $controllerResponse instanceof XenForo_ControllerResponse_View && $controllerResponse->subView)
        {
            
    $this->_defaultTemplateParams['controllerName']  = $controllerResponse->subView->controllerName;
            
    $this->_defaultTemplateParams['controllerAction'] = $controllerResponse->subView->controllerAction;
            
    $this->_defaultTemplateParams['viewName'] = $controllerResponse->subView->viewName;
        }
        else
        {
            
    $this->_defaultTemplateParams['controllerName']  = $controllerResponse->controllerName;
            
    $this->_defaultTemplateParams['controllerAction'] = $controllerResponse->controllerAction;
            
    $this->_defaultTemplateParams['viewName'] = $controllerResponse->viewName;
        }
    }
    However, the values controllerName and controllerAction are never actually set in the sub view (they are not added until the end of XenForo_FrontController::dispatch).

    As a result, when you have debug mode enabled and hover over the loading timing link at the bottom of the page, you can only see the name of the view.

    The code should therefore be something like:
    PHP:
    if ($controllerResponse)
    {
        if (
    $controllerResponse instanceof XenForo_ControllerResponse_View && $controllerResponse->subView)
        {
            
    $this->_defaultTemplateParams['viewName']= $controllerResponse->subView->viewName;
        }
        else
        {
            
    $this->_defaultTemplateParams['viewName']= $controllerResponse->viewName;
        }
        
    $this->_defaultTemplateParams['controllerName'] = $controllerResponse->controllerName;
        
    $this->_defaultTemplateParams['controllerAction'] = $controllerResponse->controllerAction;
    }
     
  2. Mike

    Mike XenForo Developer Staff Member

    Fixed, thanks.
     
    Jon W likes this.

Share This Page