Fixed Can not create editor in AdminCP

Milano

Well-known member
I got this error when trying to create editor in Admin CP
Code:
Template Errors: editor_ui.css
    Invalid argument supplied for foreach() in xxx\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 237: 236: ';
237: foreach ($customBbCodes AS $bbCodeTag => $bbCode)
 
The admin css renderer is missing some code. Here's a patch:
Class: XenForo_ViewAdmin_CssInternal

Search:
PHP:
    $templateParams = array(
       'displayStyles' => array(),
       'smilieSprites' => array(),
       'xenOptions' => XenForo_Application::get('options')->getOptions(),
       'dir' => $this->_params['dir'],
       'pageIsRtl' => ($this->_params['dir'] == 'RTL')
     );

Replace with:
PHP:
    if (XenForo_Application::isRegistered('bbCode'))
     {
       $bbCodeCache = XenForo_Application::get('bbCode');
     }
     else
     {
       $bbCodeCache = XenForo_Model::create('XenForo_Model_BbCode')->getBbCodeCache();
     }

     $templateParams = array(
       'displayStyles' => array(),
       'smilieSprites' => array(),
       'xenOptions' => XenForo_Application::get('options')->getOptions(),
       'customBbCodes' => !empty($bbCodeCache['bbCodes']) ? $bbCodeCache['bbCodes'] : array(),
       'dir' => $this->_params['dir'],
       'pageIsRtl' => ($this->_params['dir'] == 'RTL')
     );
 
Top Bottom