BP_Document_Component::setup_globals( array $args = array() )
Set up component global data.
Description
See also
- BP_Component::setup_globals(): for a description of arguments.
Parameters
- $args
-
(Optional) See BP_Component::setup_globals() for a description.
Default value: array()
Source
File: bp-document/classes/class-bp-document-component.php
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | public function setup_globals( $args = array () ) { $bp = buddypress(); // Define a slug, if necessary. if ( ! defined( 'BP_DOCUMENT_SLUG' ) ) { define( 'BP_DOCUMENT_SLUG' , $this ->id ); } // Register the visibility levels. See bp_document_get_visibility_levels() to filter. $this ->visibility_levels = array ( 'public' => __( 'Public' , 'buddyboss' ), 'loggedin' => __( 'All Members' , 'buddyboss' ), ); if ( bp_is_active( 'friends' ) ) { $this ->visibility_levels[ 'friends' ] = __( 'My Connections' , 'buddyboss' ); } if ( bp_is_active( 'groups' ) ) { $this ->visibility_levels[ 'grouponly' ] = __( 'Group members' , 'buddyboss' ); } $this ->visibility_levels[ 'onlyme' ] = __( 'Only Me' , 'buddyboss' ); // Global tables for document component. $global_tables = array ( 'table_name' => $bp ->table_prefix . 'bp_document' , 'table_name_meta' => $bp ->table_prefix . 'bp_document_meta' , 'table_name_folder' => $bp ->table_prefix . 'bp_document_folder' , 'table_name_folder_meta' => $bp ->table_prefix . 'bp_document_folder_meta' , ); // Metadata tables for groups component. $meta_tables = array ( 'document' => $bp ->table_prefix . 'bp_document_meta' , 'document_folder' => $bp ->table_prefix . 'bp_document_folder_meta' , ); // Fetch the default directory title. $default_directory_titles = bp_core_get_directory_page_default_titles(); $default_directory_title = $default_directory_titles [ $this ->id ]; // All globals for document component. // Note that global_tables is included in this array. parent::setup_globals( array ( 'slug' => 'documents' , 'root_slug' => isset( $bp ->pages->document->slug ) ? $bp ->pages->document->slug : BP_DOCUMENT_SLUG, 'has_directory' => true, 'global_tables' => $global_tables , 'directory_title' => isset( $bp ->pages->document->title ) ? $bp ->pages->document->title : $default_directory_title , 'search_string' => __( 'Search Documents…' , 'buddyboss' ), 'meta_tables' => $meta_tables , ) ); /* Single Folder Globals **********************************************/ // Are we viewing a single folder? if ( bp_is_document_component() && bp_is_single_folder() && ( $folder_id = BP_Document_Folder::folder_exists( bp_action_variable( 0 ) ) ) ) { $bp ->is_single_item = true; $this ->current_folder = folders_get_folder( $folder_id ); // Set current_folder to 0 to prevent debug errors. } else { $this ->current_folder = 0; } } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.4.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.