Changeset 27543 for trunk/src/wp-includes/widgets.php
- Timestamp:
- 03/14/2014 08:30:54 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/widgets.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/widgets.php
r27224 r27543 861 861 $sidebars_widgets = wp_get_sidebars_widgets(); 862 862 if ( empty( $wp_registered_sidebars[ $index ] ) || empty( $sidebars_widgets[ $index ] ) || ! is_array( $sidebars_widgets[ $index ] ) ) { 863 //temporary_hook #25368 864 do_action( 'temp_dynamic_sidebar_before', $index, false ); 865 //temporary_hook #25368 866 do_action( 'temp_dynamic_sidebar_after', $index, false ); 867 //temporary_hook #25368 868 return apply_filters( 'temp_dynamic_sidebar_has_widgets', false, $index ); 869 } 870 871 //temporary_hook #25368 872 do_action( 'temp_dynamic_sidebar_before', $index, true ); 863 /** This action is documented in wp-includes/widgets.php */ 864 do_action( 'dynamic_sidebar_before', $index, false ); 865 /** This action is documented in wp-includes/widgets.php */ 866 do_action( 'dynamic_sidebar_after', $index, false ); 867 /** This filter is documented in wp-includes/widgets.php */ 868 return apply_filters( 'dynamic_sidebar_has_widgets', false, $index ); 869 } 870 871 /** 872 * Fires before widgets are rendered in a dynamic sidebar. 873 * 874 * Note: The action also fires for empty sidebars, and on both the front-end 875 * and back-end, including the Inactive Widgets sidebar on the Widgets screen. 876 * 877 * @since 3.9.0 878 * 879 * @param int|string $index Index, name, or ID of the dynamic sidebar. 880 * @param bool $has_widgets Whether the sidebar is populated with widgets. 881 * Default true. 882 */ 883 do_action( 'dynamic_sidebar_before', $index, true ); 873 884 $sidebar = $wp_registered_sidebars[$index]; 874 885 … … 894 905 $params[0]['before_widget'] = sprintf($params[0]['before_widget'], $id, $classname_); 895 906 907 /** 908 * Filter the parameters passed to a widget's display callback. 909 * 910 * Note: The filter is evaluated on both the front-end and back-end, 911 * including for the Inactive Widgets sidebar on the Widgets screen. 912 * 913 * @since 2.5.0 914 * 915 * @see register_sidebar() 916 * 917 * @param array $params { 918 * @type array $args { 919 * An array of widget display arguments. 920 * 921 * @type string $name Name of the sidebar the widget is assigned to. 922 * @type string $id ID of the sidebar the widget is assigned to. 923 * @type string $description The sidebar description. 924 * @type string $class CSS class applied to the sidebar container. 925 * @type string $before_widget HTML markup to prepend to each widget in the sidebar. 926 * @type string $after_widget HTML markup to append to each widget in the sidebar. 927 * @type string $before_title HTML markup to prepend to the widget title when displayed. 928 * @type string $after_title HTML markup to append to the widget title when displayed. 929 * @type string $widget_id ID of the widget. 930 * @type string $widget_name Name of the widget. 931 * } 932 * @type array $widget_args { 933 * An array of multi-widget arguments. 934 * 935 * @type int $number Number increment used for multiples of the same widget. 936 * } 937 * } 938 */ 896 939 $params = apply_filters( 'dynamic_sidebar_params', $params ); 897 940 898 941 $callback = $wp_registered_widgets[$id]['callback']; 899 942 900 do_action( 'dynamic_sidebar', $wp_registered_widgets[$id] ); 943 /** 944 * Fires before a widget's display callback is called. 945 * 946 * Note: The action fires on both the front-end and back-end, including 947 * for widgets in the Inactive Widgets sidebar on the Widgets screen. 948 * 949 * The action is not fired for empty sidebars. 950 * 951 * @since 3.0.0 952 * 953 * @param array $widget_id { 954 * An associative array of widget arguments. 955 * 956 * @type string $name Name of the widget. 957 * @type string $id Widget ID. 958 * @type array|callback $callback When the hook is fired on the front-end, $callback is an array 959 * containing the widget object. Fired on the back-end, $callback 960 * is 'wp_widget_control', see $_callback. 961 * @type array $params An associative array of multi-widget arguments. 962 * @type string $classname CSS class applied to the widget container. 963 * @type string $description The widget description. 964 * @type array $_callback When the hook is fired on the back-end, $_callback is populated 965 * with an array containing the widget object, see $callback. 966 * } 967 */ 968 do_action( 'dynamic_sidebar', $wp_registered_widgets[ $id ] ); 901 969 902 970 if ( is_callable($callback) ) { … … 906 974 } 907 975 908 //temporary_hook #25368 909 do_action( 'temp_dynamic_sidebar_after', $index, true ); 910 //temporary_hook #25368 911 $did_one = apply_filters( 'temp_dynamic_sidebar_has_widgets', $did_one, $index ); 976 /** 977 * Fires after widgets are rendered in a dynamic sidebar. 978 * 979 * Note: The action also fires for empty sidebars, and on both the front-end 980 * and back-end, including the Inactive Widgets sidebar on the Widgets screen. 981 * 982 * @since 3.9.0 983 * 984 * @param int|string $index Index, name, or ID of the dynamic sidebar. 985 * @param bool $has_widgets Whether the sidebar is populated with widgets. 986 * Default true. 987 */ 988 do_action( 'dynamic_sidebar_after', $index, true ); 989 990 /** 991 * Filter whether a sidebar has widgets. 992 * 993 * Note: The filter is also evaluated for empty sidebars, and on both the front-end 994 * and back-end, including the Inactive Widgets sidebar on the Widgets screen. 995 * 996 * @since 3.9.0 997 * 998 * @param bool $did_one Whether at least one widget was rendered in the sidebar. 999 * Default false. 1000 * @param int|string $index Index, name, or ID of the dynamic sidebar. 1001 */ 1002 1003 $did_one = apply_filters( 'dynamic_sidebar_has_widgets', $did_one, $index ); 1004 912 1005 return $did_one; 913 1006 } … … 989 1082 $sidebars_widgets = wp_get_sidebars_widgets(); 990 1083 $is_active_sidebar = ! empty( $sidebars_widgets[$index] ); 991 //temporary_hook #25368 992 $is_active_sidebar = apply_filters( 'temp_is_active_sidebar', $is_active_sidebar, $index ); 993 return $is_active_sidebar; 1084 1085 /** 1086 * Filter whether a dynamic sidebar is considered "active". 1087 * 1088 * @since 3.9.0 1089 * 1090 * @param bool $is_active_sidebar Whether or not the sidebar should be considered "active". 1091 * In other words, whether the sidebar contains any widgets. 1092 * @param int|string $index Index, name, or ID of the dynamic sidebar. 1093 */ 1094 return apply_filters( 'is_active_sidebar', $is_active_sidebar, $index ); 994 1095 } 995 1096
Note:
See TracChangeset
for help on using the changeset viewer.