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

Extending Dependencies_Public (Adding Notice)

Discussion in 'XenForo Development Discussions' started by Robust, Nov 21, 2015.

  1. Robust

    Robust Well-Known Member

    Hey,

    In XenForo_Dependencies_Public, there's this:

    Code:
        /**
         * List of notice templates and phrases to load if the specified param is set
         *
         * @var array [param => template/phrase key]
         */
        public $notices = array(
            'showUpgradePendingNotice'    => 'notice_upgrade_pending',
            'showBoardClosedNotice'       => 'notice_board_closed',
            'isAwaitingEmailConfirmation' => 'notice_confirm_email',
            'isEmailBouncing'             => 'notice_email_bounce',
            'showCookieNotice'            => 'notice_cookies'
        );
    I want to add one more notice to this. Looking at the code, if I added one more notice here, it'd be loaded as all references to here use a foreach. Not really any template editing either, just creating my new one.

    Problem is, I'm not sure how to inject a new field value pair to this array. I know the init_dependencies hook exists, but I'm not sure it'll work in my scenario. Just a normal load_class might?
     
  2. Robust

    Robust Well-Known Member

    I also need to populate some data into here, actually.
     
  3. batpool52!

    batpool52! Well-Known Member

    Have you looked into notices_prepare code even listener?
     
  4. Robust

    Robust Well-Known Member

    In ViewRenderer? Yeah, I did, not really sure how to hook in here.
     
  5. batpool52!

    batpool52! Well-Known Member

    upload_2015-11-21_15-23-50.png
     
  6. Robust

    Robust Well-Known Member

    Yeah, I kinda got that part. Not sure what to put in the extending class (so in your example, prepareDebugDetails).

    When I said in ViewRenderer, that's where the event is fired :p
     
  7. Robust

    Robust Well-Known Member

    Well, I got it but it's weird how we need to explicitly define every attribute.
     

Share This Page