Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/04/2018 11:17:29 PM (21 months ago)
Author:
r-a-y
Message:

Core: Introduce hook, 'bp_late_include'.

This hook is meant to be used to load conditional files on certain pages
so we are not always loading code unnecessarily.

This fires on the 'bp_setup_canonical_stack' at priority 20 when we
have ensured that the canonical stack is set up and before we register
navigation items that do checks for screen functions.

We'll be using this hook across all components to offshore code until it
is required.

See #7218.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/classes/class-bp-component.php

    r10825 r11884  
    395395
    396396    /**
     397     * Late includes method.
     398     *
     399     * Components should include files here only on specific pages using
     400     * conditionals such as {@link bp_is_current_component()}. Intentionally left
     401     * empty.
     402     *
     403     * @since 3.0.0
     404     */
     405    public function late_includes() {}
     406
     407    /**
    397408     * Set up the actions.
    398409     *
     
    414425        // extending this base class.
    415426        add_action( 'bp_include',                array( $this, 'includes'               ), 8 );
     427
     428        // Load files conditionally, based on certain pages.
     429        add_action( 'bp_late_include',           array( $this, 'late_includes'          ) );
    416430
    417431        // Setup navigation.
Note: See TracChangeset for help on using the changeset viewer.