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

As Designed load_class_bb_code Event Listener Not Always Called

Discussion in 'Resolved Bug Reports' started by digitalpoint, Jun 16, 2012.

  1. digitalpoint

    digitalpoint Well-Known Member

    When loading the BBCode class, the load_class_bb_code event listener isn't firing (probably loading the class direct instead of via loader?)...

    Specifically if you edit a post, the AJAX editor that is overlayed doesn't have it fired, nor is the editor if you if you click on "More Options..." from that AJAX overlay.

    Actually, now that I test... it just seems like it's not firing anytime for things within the WYSIWYG editor.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I see no reason for this. Which class are you extending? The inline post editor would use XenForo_BbCode_Formatter_Wysiwyg (assuming the rich editor is active).
  3. digitalpoint

    digitalpoint Well-Known Member

    Am extending the formatting of smilies... So the formatting doesn't happen in the WYSYWIG...
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    But what class are you extending to make the smilie changes? What class is failing to be extended during execution?
  5. digitalpoint

    digitalpoint Well-Known Member

    It's XenForo_BbCode_Formatter_Base... Again, it works fine when viewing a thread, but not within the editor. All I'm really doing it wrapping a <span> around the smilie images...

    class DigitalPointLittleThings_BbCode_Formatter_Base extends XFCP_DigitalPointLittleThings_BbCode_Formatter_Base
    $_smilieSpriteTemplate '<span class="smileWrapper"><img src="styles/default/xenforo/clear.png" class="mceSmilieSprite mceSmilie%1$d" alt="%2$s" title="%3$s    %2$s" /></span>';
    TheVisitors likes this.
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The thread view uses "Base":


    		$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Base', array('view' => $this)));
    The inline post editor uses "Wysiwyg":


    				$bbCodeParser = new XenForo_BbCode_Parser(XenForo_BbCode_Formatter_Base::create('Wysiwyg', array('view' => $view)));
    That's why your extended class isn't working. You would have to extend "Wysiwyg" as well in your "load_class_bb_code" listener. Even though Wysiwyg extends Base, your extended Base class will only work when Base is created in the loader. So you need to name the other formatters as well.

    Also, this might be relevant when you extend the other formatters:


    I am going to call this "as designed" but leave it in the bug forum so the devs can have the final word.

Share This Page