Contexts

Bonfire includes the Contexts library in the ui module for generating the contexts menu in the admin interface and creating new contexts.

Configuration

The Contexts library can be configured by setting the $config['contexts'] array in /application/config/application.php.
When adding new contexts, you will also have to edit /application/config/routes.php if you wish to add special routing for the new context(s).
More information on routing contexts is available in the section on Improved Routes.

contexts

This setting allows configuration of the contexts which will be available in your application.
Only two contexts are required ('settings' and 'developer'), but four are provided by default.

$config['contexts'] = array('content','reports','settings','developer');

The name of the context displayed in the menu is determined by language strings defined in /application/language/{current_language}/application_lang.php.
The language strings follow the format bf_context_{context_name}.
For example:

$lang['bf_context_content']   = 'Content';
$lang['bf_context_reports']   = 'Reports';
$lang['bf_context_settings']  = 'Settings';
$lang['bf_context_developer'] = 'Developer';

If icons are enabled in the menu, the library will attempt to use the file /public/themes/{current_theme}/images/context_{context_name}.png.

Methods

setContexts(array $contexts[, $siteArea])

Sets the internal contexts array used by the library to the desired $contexts array, ensuring the required contexts are included (they will be added if they are not included).
Optionally, the value used by the library to represent the SITE_AREA constant can be overridden by passing the desired value in the second parameter, $siteArea.
Any subsequent method calls will use the values last passed to this method.
The library's constructor passes the configured 'contexts' value from /application/config/application.php and SITE_AREA to this method to initialize the library.

If $contexts is empty or not an array, this method will call die(lang('bf_no_contexts')).

getContexts([$landingPageFilter])

Return the context array.

$landingPageFilter: if true, only contexts which have a landing page available in VIEWPATH/{site_area}/{context}/index.php will be returned, but the internal contexts array is not modified. Defaults to false.

errors([$open[, $close]])

Returns a string containing any errors which have occurred so far.
Each error will be preceeded by the string supplied in $open and followed by the value supplied in $close, followed by a newline (\n) character.
By default, $open is set to '<li>' and $close is set to '</li>'.

render_menu([$mode[, $order_by[, $top_level_only[, $benchmark]]]])

Returns a string containing the HTML for a list-based menu with optional sub-menus for each context.

  • $mode: determines the content of the top-level menu (one entry per context). The valid values are 'text', 'icon', or 'both'. Defaults to 'text', but an invalid value will result in it being set to 'icon'.
  • $order_by: determines the sort order of the elements. Valid values are 'normal', 'reverse', 'asc', or 'desc'. Defaults to 'normal'.
  • $top_level_only: if true, only the top-level links will be output. Defaults to false.
  • $benchmark: If true, start/end marks will be added via the benchmark class to profile the rendering of the menu. Defaults to false.

render_mobile_navs()

Returns a string containing the HTML for a mobile-optimized menu.

context_nav($context[, $class[, $ignore_ul]])

Returns a string containing the menu for the desired context.

  • $context: the name of the context to build.
  • $class: the string applied to the '{class}' entry in the context's template. Defaults to 'dropdown-menu'.
  • $ignore_ul: prevents output of surrounding ul elements in the output when true. Defaults to false.

create_context($name[, array $roles[, $migrate]])

The create_context() method is used by the Builder module to add a new context to your application.
Creates a context and the associated permissions, then assigns those permissions to the desired roles.

  • $name is the name of the context to be created.
  • $roles is an array of roles (names or IDs) which should have permission to view this context.
  • $migrate is a currently-unused parameter intended to control whether a migration file is created (this method does not create migration files at this time).

If an error occurs, create_context() will return false, otherwise it will return true.

set_attrs(array $attrs)

Takes an array of key/value pairs ($attrs) and sets the properties (named for the keys) to the values.

build_sub_menu($context[, $ignore_ul]) Deprecated

Returns the HTML for a sub-menu.

  • $context: the name of the context to which this sub-menu is attached.
  • $ignore_ul: bypass placing the sub-menu into the template if true. Defaults to false.
Profiler
Profiler Console 0 Load Time 48.5ms Memory Used 1.12 MB Database 5 Queries vars & Config Files 116

Console

Memory Usage

Benchmarks

4 ms Loading Time: Base Classes
39 ms Controller Execution Time ( Docs / Index )
49 ms Total Execution Time

Queries

0.0002 SELECT 1 FROM `bf_ci3_sessions` WHERE `id` = '2m0igju4qhvpc7r8tilvp3n664fnf3ns'Speed: 0.0002 - Possible keys: PRIMARY - Key Used: PRIMARY - Type: const - Rows: 1 - Extra: Using INdex
0.0002 SELECT GET_LOCK('19abf44d2634f1b9e37f06592400451d', 300) AS ci_session_lockSpeed: 0.0002 - Possible keys: - Key Used: - Type: - Rows: - Extra: No tables used
0.0002 SELECT `data` FROM `bf_ci3_sessions` WHERE `id` = '2m0igju4qhvpc7r8tilvp3n664fnf3ns'Speed: 0.0002 - Possible keys: PRIMARY - Key Used: PRIMARY - Type: const - Rows: 1 - Extra:
0.0003 SHOW TABLES FROM `ulju`
0.0002 SELECT * FROM `bf_settings`Speed: 0.0002 - Possible keys: - Key Used: - Type: ALL - Rows: 37 - Extra:
0.0011 Total Query Execution Time

Session User Data

__ci_last_regenerate 1765073621
requested_page http://ulju.watchmile.com/docs/developer/ui/contexts
previous_page http://ulju.watchmile.com/docs/developer/ui/contexts

GET DATA

No GET data exists

POST DATA

No POST data exists

URI STRING

docs/developer/ui/contexts

CLASS/METHOD

docs/index

HTTP HEADERS

HTTP_ACCEPT */*
HTTP_USER_AGENT Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
HTTP_CONNECTION close
SERVER_PORT 80
SERVER_NAME ulju.watchmile.com
REMOTE_ADDR 192.168.22.2
SERVER_SOFTWARE Apache
HTTP_ACCEPT_LANGUAGE
SCRIPT_NAME /index.php
REQUEST_METHOD GET
HTTP_HOST
REMOTE_HOST
CONTENT_TYPE
SERVER_PROTOCOL HTTP/1.1
QUERY_STRING
HTTP_ACCEPT_ENCODING gzip, br, zstd, deflate
HTTP_X_FORWARDED_FOR 10.8.1.217, 216.73.216.2

CONFIG VARIABLES

base_url http://ulju.watchmile.com/
index_page
uri_protocol AUTO
url_suffix
language korean
charset UTF-8
enable_hooks true
subclass_prefix MY_
composer_autoload /home/mtov/www/ulju/application/../vendor/autoload.php
permitted_uri_chars @a-z 0-9~%.:_-,
allow_get_array true
enable_query_strings false
controller_trigger c
function_trigger m
directory_trigger d
log_threshold 0
log_path /home/mtov/www/ulju/application/logs/
log_file_extension
log_file_permissions 420
log_date_format Y-m-d H:i:s
error_views_path
cache_path /home/mtov/www/ulju/application/cache/
cache_query_string false
encryption_key targus0903Webd0g@!
sess_driver database
sess_cookie_name bf_session
sess_expiration 7200
sess_save_path ci3_sessions
sess_match_ip false
sess_time_to_update 300
sess_regenerate_destroy false
cookie_prefix
cookie_domain
cookie_path /
cookie_secure false
cookie_httponly false
standardize_newlines false
global_xss_filtering true
csrf_protection false
csrf_token_name ci_csrf_token
csrf_cookie_name ci_csrf_token
csrf_expire 7200
csrf_regenerate true
csrf_exclude_uris Array ( [0] =&gt; api/v1/(.*) )
compress_output false
time_reference UP9
rewrite_short_tags false
proxy_ips
set_language Array ( [korean] =&gt; ko [english] =&gt; en [french] =&gt; fr )
thumb_width 166
thumb_height 93
site.default_user_timezone UP9
modules_locations Array ( [/home/mtov/www/ulju/application/watchmile_modules/] =&gt; ../../application/watchmile_modules/ [/home/mtov/www/ulju/application/modules/] =&gt; ../../application/modules/ [/home/mtov/www/ulju/bonfire/modules/] =&gt; ../../bonfire/modules/ )
site.backup_folder archives/
contexts Array ( [0] =&gt; content [1] =&gt; reports [2] =&gt; settings [3] =&gt; developer )
enable_activity_logging true
sparks_path ../sparks/
template.site_path /home/mtov/www/ulju/public/
template.theme_paths Array ( [0] =&gt; themes )
template.default_layout index
template.ajax_layout ajax
template.use_mobile_themes false
template.default_theme default/
template.admin_theme admin
template.message_template &lt;div class=&quot;alert alert-{type} alert-dismissable&quot;&gt; &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;alert&quot; aria-hidden=&quot;true&quot;&gt;&amp;times;&lt;/button&gt; &lt;div&gt;{message}&lt;/div&gt; &lt;/div&gt;
template.breadcrumb_symbol :
template.parse_views false
assets.directories Array ( [base] =&gt; assets [cache] =&gt; cache [css] =&gt; css [image] =&gt; images [js] =&gt; js [module] =&gt; module )
assets.js_opener $(document).ready(function() {
assets.js_closer });
assets.css_combine false
assets.js_combine false
assets.css_minify false
assets.js_minify false
assets.encrypt_name false
assets.encode false
auth.log_failed_login_activity false
ui.current_shortcuts Array ( [form_save] =&gt; Array ( [description] =&gt; Save any form in the admin area. [action] =&gt; $(&quot;input[name=save]&quot;).click();return false; ) [create_new] =&gt; Array ( [description] =&gt; Create a new record in the module. [action] =&gt; window.location.href=$(&quot;a#create_new&quot;).attr(&quot;href&quot;); ) [select_all] =&gt; Array ( [description] =&gt; Select all records in an index page. [action] =&gt; $(&quot;table input[type=checkbox]&quot;).click();return false; ) [delete] =&gt; Array ( [description] =&gt; Delete the record(s). [action] =&gt; $(&quot;#delete-me.btn-danger&quot;).click(); ) [module_index] =&gt; Array ( [description] =&gt; Return to the index of the current module. [action] =&gt; window.location.href=$(&quot;a#list&quot;).attr(&quot;href&quot;); ) [goto_content] =&gt; Array ( [description] =&gt; Jump to the Content context. [action] =&gt; window.location.href=$(&quot;#tb_content&quot;).attr(&quot;href&quot;) ) [goto_reports] =&gt; Array ( [description] =&gt; Jump to the Reports context. [action] =&gt; window.location.href=$(&quot;#tb_reports&quot;).attr(&quot;href&quot;) ) [goto_settings] =&gt; Array ( [description] =&gt; Jump to the Settings context. [action] =&gt; window.location.href=$(&quot;#tb_settings&quot;).attr(&quot;href&quot;) ) [goto_developer] =&gt; Array ( [description] =&gt; Jump to the Developer context. [action] =&gt; window.location.href=$(&quot;#tb_developer&quot;).attr(&quot;href&quot;) ) )
emailer.write_to_file false
migrate.auto_core false
migrate.auto_app false
commonmark.valid_drivers Array ( [0] =&gt; Parsedown [1] =&gt; Markdown [2] =&gt; MarkdownExtra [3] =&gt; LeagueCommonMark )
commonmark.driver MarkdownExtended
template.front_theme default
template.site_admin_theme site_admin
template.user_admin_theme user_admin
docs.theme docs
docs.default_group developer
docs.show_dev_docs true
docs.show_app_docs true
docs.toc_file _toc.ini
docs.permitted_environments Array ( [0] =&gt; development [1] =&gt; testing [2] =&gt; production )

Files

application.php
/home/mtov/www/ulju/application/config/application.php
autoload.php
/home/mtov/www/ulju/application/config/autoload.php
config.php
/home/mtov/www/ulju/application/config/config.php
constants.php
/home/mtov/www/ulju/application/config/constants.php
application.php
/home/mtov/www/ulju/application/config/development/application.php
autoload.php
/home/mtov/www/ulju/application/config/development/autoload.php
config.php
/home/mtov/www/ulju/application/config/development/config.php
constants.php
/home/mtov/www/ulju/application/config/development/constants.php
database.php
/home/mtov/www/ulju/application/config/development/database.php
hooks.php
/home/mtov/www/ulju/application/config/development/hooks.php
profiler.php
/home/mtov/www/ulju/application/config/development/profiler.php
routes.php
/home/mtov/www/ulju/application/config/development/routes.php
events.php
/home/mtov/www/ulju/application/config/events.php
hooks.php
/home/mtov/www/ulju/application/config/hooks.php
installer_lib.php
/home/mtov/www/ulju/application/config/installer_lib.php
mimes.php
/home/mtov/www/ulju/application/config/mimes.php
profiler.php
/home/mtov/www/ulju/application/config/profiler.php
routes.php
/home/mtov/www/ulju/application/config/routes.php
Base_Controller.php
/home/mtov/www/ulju/application/core/Base_Controller.php
MY_Model.php
/home/mtov/www/ulju/application/core/MY_Model.php
MY_form_helper.php
/home/mtov/www/ulju/application/helpers/MY_form_helper.php
common_helper.php
/home/mtov/www/ulju/application/helpers/common_helper.php
App_hooks.php
/home/mtov/www/ulju/application/hooks/App_hooks.php
application_lang.php
/home/mtov/www/ulju/application/language/english/application_lang.php
application_lang.php
/home/mtov/www/ulju/application/language/korean/application_lang.php
Profiler.php
/home/mtov/www/ulju/application/libraries/Profiler.php
Base.php
/home/mtov/www/ulju/application/third_party/MX/Base.php
Config.php
/home/mtov/www/ulju/application/third_party/MX/Config.php
Controller.php
/home/mtov/www/ulju/application/third_party/MX/Controller.php
Lang.php
/home/mtov/www/ulju/application/third_party/MX/Lang.php
Loader.php
/home/mtov/www/ulju/application/third_party/MX/Loader.php
Benchmark.php
/home/mtov/www/ulju/bonfire/ci3/core/Benchmark.php
CodeIgniter.php
/home/mtov/www/ulju/bonfire/ci3/core/CodeIgniter.php
Common.php
/home/mtov/www/ulju/bonfire/ci3/core/Common.php
Config.php
/home/mtov/www/ulju/bonfire/ci3/core/Config.php
Controller.php
/home/mtov/www/ulju/bonfire/ci3/core/Controller.php
Hooks.php
/home/mtov/www/ulju/bonfire/ci3/core/Hooks.php
Input.php
/home/mtov/www/ulju/bonfire/ci3/core/Input.php
Lang.php
/home/mtov/www/ulju/bonfire/ci3/core/Lang.php
Loader.php
/home/mtov/www/ulju/bonfire/ci3/core/Loader.php
Log.php
/home/mtov/www/ulju/bonfire/ci3/core/Log.php
Model.php
/home/mtov/www/ulju/bonfire/ci3/core/Model.php
Output.php
/home/mtov/www/ulju/bonfire/ci3/core/Output.php
Router.php
/home/mtov/www/ulju/bonfire/ci3/core/Router.php
Security.php
/home/mtov/www/ulju/bonfire/ci3/core/Security.php
URI.php
/home/mtov/www/ulju/bonfire/ci3/core/URI.php
Utf8.php
/home/mtov/www/ulju/bonfire/ci3/core/Utf8.php
hash.php
/home/mtov/www/ulju/bonfire/ci3/core/compat/hash.php
mbstring.php
/home/mtov/www/ulju/bonfire/ci3/core/compat/mbstring.php
password.php
/home/mtov/www/ulju/bonfire/ci3/core/compat/password.php
standard.php
/home/mtov/www/ulju/bonfire/ci3/core/compat/standard.php
DB.php
/home/mtov/www/ulju/bonfire/ci3/database/DB.php
DB_driver.php
/home/mtov/www/ulju/bonfire/ci3/database/DB_driver.php
DB_query_builder.php
/home/mtov/www/ulju/bonfire/ci3/database/DB_query_builder.php
DB_result.php
/home/mtov/www/ulju/bonfire/ci3/database/DB_result.php
mysqli_driver.php
/home/mtov/www/ulju/bonfire/ci3/database/drivers/mysqli/mysqli_driver.php
mysqli_result.php
/home/mtov/www/ulju/bonfire/ci3/database/drivers/mysqli/mysqli_result.php
directory_helper.php
/home/mtov/www/ulju/bonfire/ci3/helpers/directory_helper.php
form_helper.php
/home/mtov/www/ulju/bonfire/ci3/helpers/form_helper.php
language_helper.php
/home/mtov/www/ulju/bonfire/ci3/helpers/language_helper.php
url_helper.php
/home/mtov/www/ulju/bonfire/ci3/helpers/url_helper.php
profiler_lang.php
/home/mtov/www/ulju/bonfire/ci3/language/english/profiler_lang.php
Cache.php
/home/mtov/www/ulju/bonfire/ci3/libraries/Cache/Cache.php
Cache_dummy.php
/home/mtov/www/ulju/bonfire/ci3/libraries/Cache/drivers/Cache_dummy.php
Driver.php
/home/mtov/www/ulju/bonfire/ci3/libraries/Driver.php
Session.php
/home/mtov/www/ulju/bonfire/ci3/libraries/Session/Session.php
Session_driver.php
/home/mtov/www/ulju/bonfire/ci3/libraries/Session/Session_driver.php
Session_database_driver.php
/home/mtov/www/ulju/bonfire/ci3/libraries/Session/drivers/Session_database_driver.php
BF_Lang.php
/home/mtov/www/ulju/bonfire/core/BF_Lang.php
BF_Loader.php
/home/mtov/www/ulju/bonfire/core/BF_Loader.php
BF_Model.php
/home/mtov/www/ulju/bonfire/core/BF_Model.php
BF_Router.php
/home/mtov/www/ulju/bonfire/core/BF_Router.php
BF_Security.php
/home/mtov/www/ulju/bonfire/core/BF_Security.php
BF_directory_helper.php
/home/mtov/www/ulju/bonfire/helpers/BF_directory_helper.php
BF_form_helper.php
/home/mtov/www/ulju/bonfire/helpers/BF_form_helper.php
application_helper.php
/home/mtov/www/ulju/bonfire/helpers/application_helper.php
config_file_helper.php
/home/mtov/www/ulju/bonfire/helpers/config_file_helper.php
markdown_extended_helper.php
/home/mtov/www/ulju/bonfire/helpers/markdown_extended_helper.php
markdown_helper.php
/home/mtov/www/ulju/bonfire/helpers/markdown_helper.php
Assets.php
/home/mtov/www/ulju/bonfire/libraries/Assets.php
CommonMark.php
/home/mtov/www/ulju/bonfire/libraries/CommonMark.php
CommonMarkDriver.php
/home/mtov/www/ulju/bonfire/libraries/CommonMark/CommonMarkDriver.php
CommonMark_MarkdownExtended.php
/home/mtov/www/ulju/bonfire/libraries/CommonMark/drivers/CommonMark_MarkdownExtended.php
Console.php
/home/mtov/www/ulju/bonfire/libraries/Console.php
Events.php
/home/mtov/www/ulju/bonfire/libraries/Events.php
Installer_lib.php
/home/mtov/www/ulju/bonfire/libraries/Installer_lib.php
Modules.php
/home/mtov/www/ulju/bonfire/libraries/Modules.php
Route.php
/home/mtov/www/ulju/bonfire/libraries/Route.php
Template.php
/home/mtov/www/ulju/bonfire/libraries/Template.php
docs.php
/home/mtov/www/ulju/bonfire/modules/docs/config/docs.php
routes.php
/home/mtov/www/ulju/bonfire/modules/docs/config/routes.php
Docs.php
/home/mtov/www/ulju/bonfire/modules/docs/controllers/Docs.php
docs_lang.php
/home/mtov/www/ulju/bonfire/modules/docs/language/english/docs_lang.php
_sidebar.php
/home/mtov/www/ulju/bonfire/modules/docs/views/_sidebar.php
index.php
/home/mtov/www/ulju/bonfire/modules/docs/views/index.php
Settings_lib.php
/home/mtov/www/ulju/bonfire/modules/settings/libraries/Settings_lib.php
Settings_model.php
/home/mtov/www/ulju/bonfire/modules/settings/models/Settings_model.php
index.php
index.php
index.php
themes/docs/index.php
autoload.php
/home/mtov/www/ulju/vendor/autoload.php
ClassLoader.php
/home/mtov/www/ulju/vendor/composer/ClassLoader.php
autoload_real.php
/home/mtov/www/ulju/vendor/composer/autoload_real.php
autoload_static.php
/home/mtov/www/ulju/vendor/composer/autoload_static.php
platform_check.php
/home/mtov/www/ulju/vendor/composer/platform_check.php
functions.php
/home/mtov/www/ulju/vendor/guzzlehttp/guzzle/src/functions.php
functions_include.php
/home/mtov/www/ulju/vendor/guzzlehttp/guzzle/src/functions_include.php
functions.php
/home/mtov/www/ulju/vendor/guzzlehttp/promises/src/functions.php
functions_include.php
/home/mtov/www/ulju/vendor/guzzlehttp/promises/src/functions_include.php
functions.php
/home/mtov/www/ulju/vendor/guzzlehttp/psr7/src/functions.php
functions_include.php
/home/mtov/www/ulju/vendor/guzzlehttp/psr7/src/functions_include.php
deep_copy.php
/home/mtov/www/ulju/vendor/myclabs/deep-copy/src/DeepCopy/deep_copy.php
getallheaders.php
/home/mtov/www/ulju/vendor/ralouphie/getallheaders/src/getallheaders.php
bootstrap.php
/home/mtov/www/ulju/vendor/symfony/polyfill-ctype/bootstrap.php
bootstrap.php
/home/mtov/www/ulju/vendor/symfony/polyfill-intl-idn/bootstrap.php
bootstrap.php
/home/mtov/www/ulju/vendor/symfony/polyfill-intl-normalizer/bootstrap.php
bootstrap.php
/home/mtov/www/ulju/vendor/symfony/polyfill-php72/bootstrap.php