Changeset 11144 for trunk/src/bp-groups/bp-groups-functions.php
- Timestamp:
- 09/21/2016 10:40:12 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-functions.php
r11142 r11144 2116 2116 * 2117 2117 * @since 2.6.0 2118 * @since 2.7.0 Introduce $has_directory, $show_in_create_screen, $show_in_list, and 2119 * $description as $args parameters. 2118 2120 * 2119 2121 * @param string $group_type Unique string identifier for the group type. … … 2121 2123 * Array of arguments describing the group type. 2122 2124 * 2123 * @type array $labels { 2125 * @type string|bool $has_directory Set the slug to be used for custom group directory page. eg. 2126 * example.com/groups/type/MY_SLUG. Default: false. 2127 * @type bool $show_in_create_screen Whether this group type is allowed to be selected on the group creation 2128 * page. Default: false. 2129 * @type bool|null $show_in_list Whether this group type should be shown in lists rendered by 2130 * bp_group_type_list(). Default: null. If $show_in_create_screen is true, 2131 * this will default to true, unless this is set explicitly to false. 2132 * @type string $description A short descriptive summary of what the group type is. Currently shown 2133 * on a group's "Manage > Settings" page when selecting group types. 2134 * @type array $labels { 2124 2135 * Array of labels to use in various parts of the interface. 2125 2136 * … … 2138 2149 2139 2150 $r = bp_parse_args( $args, array( 2140 'labels' => array(), 2151 'has_directory' => false, 2152 'show_in_create_screen' => false, 2153 'show_in_list' => null, 2154 'description' => '', 2155 'labels' => array(), 2141 2156 ), 'register_group_type' ); 2142 2157 … … 2168 2183 'singular_name' => $default_name, 2169 2184 ), $r['labels'] ); 2185 2186 // Directory slug. 2187 if ( ! empty( $r['has_directory'] ) ) { 2188 // A string value is intepreted as the directory slug. 2189 if ( is_string( $r['has_directory'] ) ) { 2190 $directory_slug = $r['has_directory']; 2191 2192 // Otherwise fall back on group type. 2193 } else { 2194 $directory_slug = $group_type; 2195 } 2196 2197 // Sanitize for use in URLs. 2198 $r['directory_slug'] = sanitize_title( $directory_slug ); 2199 $r['has_directory'] = true; 2200 } else { 2201 $r['directory_slug'] = ''; 2202 $r['has_directory'] = false; 2203 } 2204 2205 // Type lists. 2206 if ( true === $r['show_in_create_screen'] && is_null( $r['show_in_list'] ) ) { 2207 $r['show_in_list'] = true; 2208 } else { 2209 $r['show_in_list'] = (bool) $r['show_in_list']; 2210 } 2170 2211 2171 2212 $bp->groups->types[ $group_type ] = $type = (object) $r;
Note: See TracChangeset
for help on using the changeset viewer.