Skip to:
Content

BuddyPress.org

Changeset 9595


Ignore:
Timestamp:
03/05/2015 04:55:12 AM (7 years ago)
Author:
tw2113
Message:

Adds hooks documentation for bp-core-template-loader.php.

See #5940.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-template-loader.php

    r9399 r9595  
    3333
    3434    // Execute code for this part
     35    /**
     36     * Fires at the start of bp_get_template_part().
     37     *
     38     * This is a variable hook that is dependent on the slug passed in.
     39     *
     40     * @since BuddyPress (1.7.0)
     41     *
     42     * @param string $slug Template part slug requested.
     43     * @param string $name Template part name requested.
     44     */
    3545    do_action( 'get_template_part_' . $slug, $slug, $name );
    3646
     
    4353
    4454    // Allow template parts to be filtered
     55    /**
     56     * Filters the template parts to be loaded.
     57     *
     58     * @since BuddyPress (1.7.0)
     59     *
     60     * @param array  $templates Array of templates located.
     61     * @param string $slug      Template part slug requested.
     62     * @param string $name      Template part name requested.
     63     */
    4564    $templates = apply_filters( 'bp_get_template_part', $templates, $slug, $name );
    4665
     
    216235    $stack = array_unique( array_filter( $stack ) );
    217236
     237    /**
     238     * Filters the "template stack" list of registered directories where templates can be found.
     239     *
     240     * @since BuddyPress (1.7.0)
     241     *
     242     * @param array $stack Array of registered directories for template locations.
     243     */
    218244    return (array) apply_filters( 'bp_get_template_stack', $stack ) ;
    219245}
     
    279305    }
    280306
     307    /**
     308     * Filters possible file paths to check for for a template.
     309     *
     310     * This is a variable filter based on the type passed into
     311     * bp_get_query_template.
     312     *
     313     * @since BuddyPress (1.7.0)
     314     *
     315     * @param array $templates Array of template files already prepared.
     316     */
     317    $templates = apply_filters( "bp_get_{$type}_template", $templates );
     318
    281319    // Filter possible templates, try to match one, and set any BuddyPress theme
    282320    // compat properties so they can be cross-checked later.
    283     $templates = apply_filters( "bp_get_{$type}_template", $templates );
    284321    $templates = bp_set_theme_compat_templates( $templates );
    285322    $template  = bp_locate_template( $templates );
    286323    $template  = bp_set_theme_compat_template( $template );
    287324
     325    /**
     326     * Filters the path to a template file.
     327     *
     328     * This is a variable filter based on the type passed into
     329     * bp_get_query_template.
     330     *
     331     * @since BuddyPress (1.7.0)
     332     *
     333     * @param string $template Path to the most appropriate found template file.
     334     */
    288335    return apply_filters( "bp_{$type}_template", $template );
    289336}
     
    292339 * Get the possible subdirectories to check for templates in
    293340 *
    294  * @since BuddyPress (1.7)
     341 * @since BuddyPress (1.7.0)
    295342 * @param array $templates Templates we are looking for
    296343 * @return array Possible subfolders to look in
     
    302349        ''
    303350    );
     351
     352    /**
     353     * Filters the possible subdirectories to check for templates in.
     354     *
     355     * @since BuddyPress (1.7.0)
     356     *
     357     * @param array $locations Array of subfolders to look in.
     358     * @param array $templates Array of templates we are looking for.
     359     */
    304360    return apply_filters( 'bp_get_template_locations', $locations, $templates );
    305361}
     
    326382    }
    327383
     384    /**
     385     * Filters the template locations to template files being searched for.
     386     *
     387     * @since BuddyPress (1.7.0)
     388     *
     389     * @param array $value  Array of all template locations registered so far.
     390     * @param array $stacks Array of template locations.
     391     */
    328392    return apply_filters( 'bp_add_template_stack_locations', array_unique( $retval ), $stacks );
    329393}
     
    353417    }
    354418
    355     // Allow BuddyPress components to parse the main query
     419    /**
     420     * Fires at the end of the bp_parse_query function.
     421     *
     422     * Allow BuddyPress components to parse the main query.
     423     *
     424     * @since BuddyPress (1.7.0)
     425     *
     426     * @param WP_Query $posts_query WP_Query instance. Passed by reference.
     427     */
    356428    do_action_ref_array( 'bp_parse_query', array( &$posts_query ) );
    357429}
     
    374446function bp_template_include_theme_supports( $template = '' ) {
    375447
    376     // Look for root BuddyPress template files in parent/child themes
     448    /**
     449     * Filters whether or not to override the template being loaded in parent/child themes.
     450     *
     451     * @since BuddyPress (1.7.0)
     452     *
     453     * @param bool   $value    Whether or not there is a file override. Default false.
     454     * @param string $template The path to the template file that is being used.
     455     */
    377456    $new_template = apply_filters( 'bp_get_root_template', false, $template );
    378457
     
    383462    }
    384463
     464    /**
     465     * Filters the final template being loaded in parent/child themes.
     466     *
     467     * @since BuddyPress (1.7.0)
     468     *
     469     * @param string $template The path to the template file that is being used.
     470     */
    385471    return apply_filters( 'bp_template_include_theme_supports', $template );
    386472}
Note: See TracChangeset for help on using the changeset viewer.