5 * This contains deprecated functions that will be removed in a future release.
8 use Drupal\bootstrap\Bootstrap;
9 use Drupal\bootstrap\Plugin\ProviderManager;
10 use Drupal\bootstrap\Utility\Element;
11 use Drupal\bootstrap\Utility\Unicode;
12 use Drupal\Component\Utility\NestedArray;
15 * The base file system path for CDN providers.
17 * @deprecated Will be removed in a future release.
21 * echo BOOTSTRAP_CDN_PROVIDER_PATH;
24 * use Drupal\bootstrap\Plugin\ProviderManager;
25 * echo ProviderManager::FILE_PATH;
28 * @see \Drupal\bootstrap\Plugin\ProviderManager::FILE_PATH
30 define('BOOTSTRAP_CDN_PROVIDER_PATH', ProviderManager::FILE_PATH);
33 * The current supported Bootstrap framework major version number.
35 * @deprecated Will be removed in a future release.
39 * echo BOOTSTRAP_VERSION_MAJOR;
42 * use Drupal\bootstrap\Bootstrap;
43 * echo substr(Bootstrap::FRAMEWORK_VERSION, 0, 1);
46 * @see \Drupal\bootstrap\Bootstrap::FRAMEWORK_VERSION
48 define('BOOTSTRAP_VERSION_MAJOR', substr(Bootstrap::FRAMEWORK_VERSION, 0, 1));
51 * The current supported Bootstrap framework minor version number.
53 * @deprecated Will be removed in a future release.
57 * echo BOOTSTRAP_VERSION_MINOR;
60 * use Drupal\bootstrap\Bootstrap;
61 * echo substr(Bootstrap::FRAMEWORK_VERSION, 2, 1);
64 * @see \Drupal\bootstrap\Bootstrap::FRAMEWORK_VERSION
66 define('BOOTSTRAP_VERSION_MINOR', substr(Bootstrap::FRAMEWORK_VERSION, 2, 1));
69 * The current supported Bootstrap framework patch version number.
71 * @deprecated Will be removed in a future release.
75 * echo BOOTSTRAP_VERSION_PATCH;
78 * use Drupal\bootstrap\Bootstrap;
79 * echo substr(Bootstrap::FRAMEWORK_VERSION, 4, 1);
82 * @see \Drupal\bootstrap\Bootstrap::FRAMEWORK_VERSION
84 define('BOOTSTRAP_VERSION_PATCH', substr(Bootstrap::FRAMEWORK_VERSION, 4, 1));
87 * The current supported Bootstrap framework version.
89 * @deprecated Will be removed in a future release.
93 * echo BOOTSTRAP_VERSION;
96 * use Drupal\bootstrap\Bootstrap;
97 * echo Bootstrap::FRAMEWORK_VERSION;
100 * @see \Drupal\bootstrap\Bootstrap::FRAMEWORK_VERSION
102 define('BOOTSTRAP_VERSION', Bootstrap::FRAMEWORK_VERSION);
105 * Adds a class to an element's render array.
107 * @param string|array $class
108 * An individual class or an array of classes to add.
109 * @param array $element
110 * The individual renderable array element. It is possible to also pass the
111 * $variables parameter in [pre]process functions and it will logically
112 * determine the correct path to that particular theme hook's classes array.
113 * Passed by reference.
114 * @param string $property
115 * Determines which attributes array to retrieve. By default, this is the
116 * element's normal "attributes", but it could also be one of the following:
117 * - "content_attributes"
118 * - "input_group_attributes"
119 * - "title_attributes"
120 * - "wrapper_attributes".
122 * @deprecated Will be removed in a future release.
126 * _bootstrap_add_class('my-class', $element);
129 * use Drupal\bootstrap\Utility\Element;
130 * Element::create($element)->addClass('my-class');
133 * @see \Drupal\bootstrap\Utility\Element::addClass()
135 function _bootstrap_add_class($class, array &$element, $property = 'attributes') {
136 Bootstrap::deprecated();
137 Element::create($element)->addClass($class, $property);
141 * Adds a specific Bootstrap class to color a button based on its text value.
143 * @param array $element
144 * The form element, passed by reference.
146 * @deprecated Will be removed in a future release.
150 * _bootstrap_colorize_button($element);
153 * use Drupal\bootstrap\Utility\Element;
154 * Element::create($element)->colorize();
157 * @see \Drupal\bootstrap\Utility\Element::colorize()
159 function _bootstrap_colorize_button(array &$element) {
160 Bootstrap::deprecated();
161 Element::create($element)->colorize();
165 * Matches a Bootstrap class based on a string value.
167 * @param string $string
168 * The string to match classes against.
169 * @param string $default
170 * The default class to return if no match is found.
173 * The Bootstrap class matched against the value of $haystack or $default if
174 * no match could be made.
176 * @deprecated Will be removed in a future release.
180 * $class = _bootstrap_colorize_text($string, $default);
183 * use Drupal\bootstrap\Bootstrap;
184 * $class = Bootstrap::cssClassFromString($string, $default);
187 * @see \Drupal\bootstrap\Bootstrap::cssClassFromString()
189 function _bootstrap_colorize_text($string, $default = '') {
190 Bootstrap::deprecated();
191 return Bootstrap::cssClassFromString($string, $default);
195 * Wrapper for the core file_scan_directory() function.
197 * Finds all files that match a given mask in a given directory and then caches
198 * the results. A general site cache clear will force new scans to be initiated
199 * for already cached directories.
202 * The base directory or URI to scan, without trailing slash.
203 * @param string $mask
204 * The preg_match() regular expression of the files to find.
205 * @param array $options
206 * Additional options to pass to file_scan_directory().
209 * An associative array (keyed on the chosen key) of objects with 'uri',
210 * 'filename', and 'name' members corresponding to the matching files.
212 * @deprecated Will be removed in a future release.
216 * $files = _bootstrap_file_scan_directory($theme_path . '/js', '/\.js$/');
219 * use Drupal\bootstrap\Bootstrap;
220 * $files = Bootstrap::getTheme()->fileScan('/\.js$/', 'js');
223 * @see \Drupal\bootstrap\Theme::fileScan()
224 * @see file_scan_directory()
226 function _bootstrap_file_scan_directory($dir, $mask, array $options = []) {
227 Bootstrap::deprecated();
228 $theme = Bootstrap::getTheme();
229 $dir = preg_replace('/^' . preg_quote($theme->getPath()) . '\//', '', $dir);
230 return $theme->fileScan($mask, $dir, $options);
234 * Retrieves an element's "attributes" array.
236 * @param array $element
237 * The individual renderable array element, passed by reference.
238 * @param string $property
239 * Determines which attributes array to retrieve. By default, this is the
240 * element's normal "attributes", but it could also be one of the following:
241 * - "content_attributes"
242 * - "input_group_attributes"
243 * - "title_attributes"
244 * - "wrapper_attributes".
247 * The attributes array.
249 * @deprecated Will be removed in a future release.
253 * $attributes = &_bootstrap_get_attributes($element);
254 * $attributes['class'][] = 'my-class';
257 * use Drupal\bootstrap\Utility\Element;
258 * $attributes = &Element::create($element)->getAttributes();
259 * $attributes['class'][] = 'my-class';
262 * @see \Drupal\bootstrap\Utility\Element::getAttributes()
264 function &_bootstrap_get_attributes(array &$element, $property = 'attributes') {
265 Bootstrap::deprecated();
266 return Element::create($element)->getAttributes($property);
270 * Returns a list of base themes for active or provided theme.
272 * @param string $theme_key
273 * The machine name of the theme to check, if not set the active theme name
275 * @param bool $include_theme_key
276 * Whether to append the returned list with $theme_key.
279 * An indexed array of base themes.
281 * @deprecated Will be removed in a future release.
284 * // Before (including active theme).
285 * $base_themes = _bootstrap_get_base_themes(NULL, TRUE);
287 * // Before (excluding active theme).
288 * $base_themes = _bootstrap_get_base_themes('my_subtheme');
290 * // After (including active theme).
291 * use Drupal\bootstrap\Bootstrap;
292 * $theme = Bootstrap::getTheme();
293 * $base_themes = array_keys($theme->getAncestry());
295 * // After (excluding active theme).
296 * use Drupal\bootstrap\Bootstrap;
297 * $my_subtheme = Bootstrap::getTheme('my_subtheme');
298 * $base_themes = array_keys($my_subtheme->getAncestry());
299 * array_pop($base_themes);
302 * @see \Drupal\bootstrap\Theme::getAncestry()
304 function _bootstrap_get_base_themes($theme_key = NULL, $include_theme_key = FALSE) {
305 Bootstrap::deprecated();
306 $themes = array_keys(Bootstrap::getTheme($theme_key)->getAncestry());
307 if (!$include_theme_key) {
314 * Retrieves an element's "class" attribute array.
316 * @param array $element
317 * The individual renderable array element, passed by reference.
318 * @param string $property
319 * Determines which attributes array to retrieve. By default, this is the
320 * element's normal "attributes", but it could also be one of the following:
321 * - "content_attributes"
322 * - "input_group_attributes"
323 * - "title_attributes"
324 * - "wrapper_attributes".
329 * @deprecated Will be removed in a future release. There is no replacement.
333 * $classes = &_bootstrap_get_classes($element);
334 * $classes[] = 'my-class';
337 * use Drupal\bootstrap\Utility\Element;
338 * $classes = &Element::create($element)->getClasses();
339 * $classes[] = 'my-class';
342 * @see \Drupal\bootstrap\Utility\Element::getClasses()
344 function &_bootstrap_get_classes(array &$element, $property = 'attributes') {
345 Bootstrap::deprecated();
346 return Element::create($element)->getClasses($property);
350 * Returns a specific Bootstrap Glyphicon as a render array.
352 * Note: This function was added in 7.x-3.17 to keep BC with the former
353 * _bootstrap_icon() implementation since it didn't return a render array. It
354 * is basically a backport of 8.x-3.x code so the added $attributes parameter
355 * can be more easily dealt with.
357 * @param string $name
358 * The icon name, minus the "glyphicon-" prefix.
359 * @param array|string $default
360 * (Optional) The default render array to use if $name is not available.
361 * @param array $attributes
362 * (Optional) Additional attributes to merge onto the icon.
365 * The render containing the icon defined by $name, $default value if
366 * icon does not exist or returns NULL if no icon could be rendered.
368 * @deprecated Will be removed in a future release.
372 * $icon = _bootstrap_glyphicon($name, $default, $attributes);
375 * use Drupal\bootstrap\Bootstrap;
376 * use Drupal\bootstrap\Utility\Element;
377 * $icon = Bootstrap::glyphicon($name, ['#markup' => $default]);
378 * $icon_attributes = isset($icon['#attributes']) ? $icon['#attributes'] : [];
379 * unset($icon['#attributes']);
380 * $icon = Element::createStandalone($icon)->setAttributes($attributes)->setAttributes($icon_attributes)->getArray();
383 * @see https://www.drupal.org/project/bootstrap/issues/2844885
384 * @see \Drupal\bootstrap\Bootstrap::glyphicon()
385 * @see \Drupal\bootstrap\Utility\Element::createStandalone()
387 function _bootstrap_glyphicon($name, $default = [], array $attributes = []) {
388 Bootstrap::deprecated();
389 $icon = Bootstrap::glyphicon($name, ['#markup' => $default]);
390 $icon_attributes = isset($icon['#attributes']) ? $icon['#attributes'] : [];
391 unset($icon['#attributes']);
392 return Element::createStandalone($icon)->setAttributes($attributes)->setAttributes($icon_attributes)->getArray();
396 * Returns a list of available Bootstrap Glyphicons.
398 * @param string $version
399 * The specific version of glyphicons to return. If not set, the latest
400 * BOOTSTRAP_VERSION will be used.
403 * An associative array of icons keyed by their classes.
405 * @deprecated Will be removed in a future release.
409 * $glyphicons = _bootstrap_glyphicons($version);
412 * use Drupal\bootstrap\Bootstrap;
413 * $glyphicons = Bootstrap::glyphicons($version);
416 * @see \Drupal\bootstrap\Bootstrap::glyphicons()
418 function _bootstrap_glyphicons($version = NULL) {
419 Bootstrap::deprecated();
420 return Bootstrap::glyphicons($version);
424 * Determine whether or not Bootstrap Glyphicons can be used.
426 * @deprecated Will be removed in a future release.
430 * $supported = _bootstrap_glyphicons_supported();
433 * use Drupal\bootstrap\Bootstrap;
434 * $theme = Bootstrap::getTheme();
435 * $supported = $theme->hasGlyphicons();
438 * @see \Drupal\bootstrap\Theme::hasGlyphicons()
440 function _bootstrap_glyphicons_supported() {
441 Bootstrap::deprecated();
442 return Bootstrap::getTheme()->hasGlyphicons();
446 * Returns a specific Bootstrap Glyphicon as rendered HTML markup.
448 * @param string $name
449 * The icon name, minus the "glyphicon-" prefix.
450 * @param string $default
451 * (Optional) The default value to return.
452 * @param array $attributes
453 * (Optional) Additional attributes to merge onto the icon.
456 * The HTML markup containing the icon defined by $name, $default value if
457 * icon does not exist or returns empty output for whatever reason.
459 * @deprecated Will be removed in a future release.
463 * $icon = _bootstrap_icon($name, $default, $attributes);
466 * use Drupal\bootstrap\Bootstrap;
467 * use Drupal\bootstrap\Utility\Element;
468 * $icon = Bootstrap::glyphicon($name, ['#markup' => $default]);
469 * $icon_attributes = isset($icon['#attributes']) ? $icon['#attributes'] : [];
470 * unset($icon['#attributes']);
471 * $icon = (string) Element::createStandalone($icon)->setAttributes($attributes)->setAttributes($icon_attributes)->renderPlain();
474 * @see \Drupal\bootstrap\Bootstrap::glyphicon()
475 * @see \Drupal\bootstrap\Utility\Element::createStandalone()
477 function _bootstrap_icon($name, $default = NULL, array $attributes = []) {
478 Bootstrap::deprecated();
479 $icon = Bootstrap::glyphicon($name, ['#markup' => $default]);
480 $icon_attributes = isset($icon['#attributes']) ? $icon['#attributes'] : [];
481 unset($icon['#attributes']);
482 return (string) Element::createStandalone($icon)->setAttributes($attributes)->setAttributes($icon_attributes)->renderPlain();
486 * Adds an icon to button element based on its text value.
488 * @param array $element
489 * The form element, passed by reference.
491 * @deprecated Will be removed in a future release.
495 * _bootstrap_iconize_button($element);
498 * use Drupal\bootstrap\Utility\Element;
499 * Element::create($element)->setIcon();
502 * @see \Drupal\bootstrap\Utility\Element::setIcon()
504 function _bootstrap_iconize_button(array &$element) {
505 Bootstrap::deprecated();
506 Element::create($element)->setIcon();
510 * Matches a Bootstrap Glyphicon based on a string value.
512 * @param string $string
513 * The string to match classes against.
514 * @param string $default
515 * The default icon to return if no match is found.
518 * The Bootstrap icon matched against the value of $haystack or $default if
519 * no match could be made.
521 * @deprecated Will be removed in a future release.
525 * $icon = _bootstrap_iconize_text($string, $default);
528 * use Drupal\bootstrap\Bootstrap;
529 * $icon = Bootstrap::glyphiconFromString($string, ['#markup' => $default]);
532 * @see \Drupal\bootstrap\Bootstrap::glyphiconFromString()
534 function _bootstrap_iconize_text($string, $default = '') {
535 Bootstrap::deprecated();
536 return Bootstrap::glyphiconFromString($string, ['#markup' => $default]);
540 * Determines if an element is a button.
542 * @param array $element
543 * A render array element.
548 * @deprecated Will be removed in a future release.
552 * $button = _bootstrap_is_button($element);
555 * use Drupal\bootstrap\Utility\Element;
556 * $button = Element::create($element)->isButton();
559 * @see \Drupal\bootstrap\Utility\Element::isButton()
561 function _bootstrap_is_button(array $element) {
562 Bootstrap::deprecated();
563 return Element::create($element)->isButton();
567 * Determines if a string of text is considered "simple".
569 * @param string $string
570 * The string of text to check "simple" criteria on.
571 * @param int|false $length
572 * The length of characters used to determine whether or not $string is
573 * considered "simple". Set explicitly to FALSE to disable this criteria.
574 * @param array|false $allowed_tags
575 * An array of allowed tag elements. Set explicitly to FALSE to disable this
578 * A variable, passed by reference, that indicates whether or not the
579 * string contains HTML.
582 * Returns TRUE if the $string is considered "simple", FALSE otherwise.
584 * @deprecated Will be removed in a future release.
588 * $simple = _bootstrap_is_simple_string($string, $length, $allowed_tags, $html);
591 * use Drupal\bootstrap\Utility\Unicode;
592 * $simple = Unicode::isSimple($string, $length, $allowed_tags, $html);
595 * @see \Drupal\bootstrap\Utility\Unicode::isSimple()
597 function _bootstrap_is_simple_string($string, $length = 250, $allowed_tags = NULL, &$html = FALSE) {
598 Bootstrap::deprecated();
599 return Unicode::isSimple($string, $length, $allowed_tags, $html);
603 * Removes a class from an element's attributes array.
605 * @param string|array $class
606 * An individual class or an array of classes to remove.
607 * @param array $element
608 * The individual renderable array element.
609 * @param string $property
610 * Determines which attributes array to retrieve. By default, this is the
611 * element's normal "attributes", but it could also be one of the following:
612 * - "content_attributes"
613 * - "input_group_attributes"
614 * - "title_attributes"
615 * - "wrapper_attributes".
617 * @deprecated Will be removed in a future release.
621 * _bootstrap_remove_class('my-class', $element);
624 * use Drupal\bootstrap\Utility\Element;
625 * Element::create($element)->removeClass('my-class');
628 * @see \Drupal\bootstrap\Utility\Element::removeClass()
630 function _bootstrap_remove_class($class, array &$element, $property = 'attributes') {
631 Bootstrap::deprecated();
632 Element::create($element)->removeClass($class, $property);
636 * Retrieves a list of available CDN providers for the Bootstrap framework.
638 * @param string $provider
639 * A specific provider data to return.
641 * Toggle determining whether or not to reset the database cache.
643 * @return array|false
644 * An associative array of CDN providers, keyed by their machine name if
645 * $provider is not set. If $provider is set and exists, it's individual
646 * data array will be returned. If $provider is set and the data does not
647 * exist then FALSE will be returned.
649 * @deprecated Will be removed in a future release.
653 * $providers = bootstrap_cdn_provider();
654 * $jsdelivr = bootstrap_cdn_provider('jsdelivr');
657 * use Drupal\bootstrap\Bootstrap;
658 * use Drupal\bootstrap\Plugin\ProviderManager;
660 * $theme = Bootstrap::getTheme();
662 * // Get provider definitions, the "equivalent" for bootstrap_cdn_provider().
663 * $provider_manager = new ProviderManager($theme);
664 * $providers = $provider_manager->getDefinitions();
665 * $jsdelivr = $provider_manager->getDefinition('jsdelivr');
667 * // You should, however, use the the fully initialized classes made
668 * // available through a theme instance.
669 * $providers = $theme->getProviders();
670 * $jsdelivr = $theme->getProvider('jsdelivr');
673 * @see \Drupal\bootstrap\Plugin\ProviderManager
674 * @see \Drupal\bootstrap\Theme::getProviders()
675 * @see \Drupal\bootstrap\Theme::getProvider()
677 function bootstrap_cdn_provider($provider = NULL, $reset = FALSE) {
678 Bootstrap::deprecated();
679 $provider_manager = new ProviderManager(Bootstrap::getTheme());
681 $provider_manager->clearCachedDefinitions();
683 if (isset($provider)) {
684 if ($provider_manager->hasDefinition($provider)) {
685 return $provider_manager->getDefinition($provider);
689 return $provider_manager->getDefinitions();
693 * Converts an element description into a tooltip based on certain criteria.
695 * @param array $element
696 * An element render array, passed by reference.
697 * @param array $target
698 * The target element render array the tooltip is to be attached to, passed
699 * by reference. If not set, it will default to the $element passed.
700 * @param bool $input_only
701 * Toggle determining whether or not to only convert input elements.
703 * The length of characters to determine if description is "simple".
705 * @deprecated Will be removed in a future release.
709 * bootstrap_element_smart_description($element, $target, $input_only, $length);
712 * use Drupal\bootstrap\Utility\Element;
713 * Element::create($element)->smartDescription($target, $input_only, $length);
716 * @see \Drupal\bootstrap\Utility\Element::smartDescription()
718 function bootstrap_element_smart_description(array &$element, array &$target = NULL, $input_only = TRUE, $length = NULL) {
719 Bootstrap::deprecated();
720 Element::create($element)->smartDescription($target, $input_only, $length);
724 * Retrieves CDN assets for the active provider, if any.
726 * @param string|array $type
727 * The type of asset to retrieve: "css" or "js", defaults to an array
728 * array containing both if not set.
729 * @param string $provider
730 * The name of a specific CDN provider to use, defaults to the active provider
731 * set in the theme settings.
732 * @param string $theme
733 * The name of a specific theme the settings should be retrieved from,
734 * defaults to the active theme.
737 * If $type is a string or an array with only one (1) item in it, the assets
738 * are returned as an indexed array of files. Otherwise, an associative array
739 * is returned keyed by the type.
741 * @deprecated Will be removed in a future release.
745 * $assets = bootstrap_get_cdn_assets($type, $provider, $theme);
748 * use Drupal\bootstrap\Bootstrap;
749 * $theme = Bootstrap::getTheme($theme);
751 * if ($provider = $theme->getProvider($provider)) {
752 * $assets = $provider->getAssets($type);
756 * @see \Drupal\bootstrap\Plugin\Provider\Custom::getAssets()
757 * @see \Drupal\bootstrap\Plugin\Provider\JsDelivr::getAssets()
758 * @see \Drupal\bootstrap\Plugin\Provider\ProviderBase::getAssets()
759 * @see \Drupal\bootstrap\Plugin\Provider\ProviderInterface::getAssets()
760 * @see \Drupal\bootstrap\Theme::getProvider()
761 * @see \Drupal\bootstrap\Bootstrap::getTheme()
763 function bootstrap_get_cdn_assets($type = NULL, $provider = NULL, $theme = NULL) {
764 Bootstrap::deprecated();
766 if ($provider = Bootstrap::getTheme($theme)->getProvider($provider)) {
767 $assets = $provider->getAssets($type);
773 * Return information from the .info file of a theme (and possible base themes).
775 * @param string $theme_key
776 * The machine name of the theme.
778 * The key name of the item to return from the .info file. This value can
779 * include "][" to automatically attempt to traverse any arrays.
780 * @param bool $base_themes
781 * Recursively search base themes, defaults to TRUE.
783 * @return string|array|false
784 * A string or array depending on the type of value and if a base theme also
785 * contains the same $key, FALSE if no $key is found.
787 * @deprecated Will be removed in a future release. There is no replacement.
789 function bootstrap_get_theme_info($theme_key = NULL, $key = NULL, $base_themes = TRUE) {
790 Bootstrap::deprecated();
791 // If no $theme_key is given, use the current theme if we can determine it.
792 if (!isset($theme_key)) {
793 $theme_key = !empty($GLOBALS['theme_key']) ? $GLOBALS['theme_key'] : FALSE;
796 $themes = \Drupal::service('theme_handler')->listInfo();
797 if (!empty($themes[$theme_key])) {
798 $theme = $themes[$theme_key];
799 // If a key name was specified, return just that array.
802 // Recursively add base theme values.
803 if ($base_themes && isset($theme->base_themes)) {
804 foreach (array_keys($theme->base_themes) as $base_theme) {
805 $value = bootstrap_get_theme_info($base_theme, $key);
808 if (!empty($themes[$theme_key])) {
809 $info = $themes[$theme_key]->info;
810 // Allow array traversal.
811 $keys = explode('][', $key);
812 foreach ($keys as $parent) {
813 if (isset($info[$parent])) {
814 $info = $info[$parent];
820 if (is_array($value)) {
822 if (!is_array($info)) {
825 $value = NestedArray::mergeDeep($value, $info);
834 if (!is_array($value)) {
837 if (!is_array($info)) {
840 $value = NestedArray::mergeDeep($value, $info);
847 // If no info $key was specified, just return the entire info array.
855 * Includes a file from a theme.
857 * @param string $theme
858 * Name of the theme to use for base path.
859 * @param string $path
860 * Path relative to $theme.
862 * @deprecated Will be removed in a future release.
866 * bootstrap_include('my_subtheme', 'includes/file.inc');
867 * bootstrap_include('my_subtheme', 'some/other/path/file.inc');
870 * use Drupal\bootstrap\Bootstrap;
871 * $my_subtheme = Bootstrap::getTheme('my_subtheme');
872 * $my_subtheme->includeOnce('file.inc');
873 * $my_subtheme->includeOnce('file.inc', 'some/other/path');
876 * @see \Drupal\bootstrap\Theme::includeOnce()
877 * @see \Drupal\bootstrap\Bootstrap::getTheme()
879 function bootstrap_include($theme, $path) {
880 Bootstrap::deprecated();
881 $theme = Bootstrap::getTheme($theme);
882 $parts = explode('/', $path);
883 $file = array_pop($parts);
884 $dir = implode('/', $parts);
885 $theme->includeOnce($file, $dir);
889 * Retrieves a setting for the current theme or for a given theme.
891 * @param string $name
892 * The name of the setting to be retrieved.
893 * @param string $theme
894 * The name of a given theme; defaults to the currently active theme.
895 * @param string $prefix
896 * The prefix used on the $name of the setting, this will be appended with
897 * "_" automatically if set.
898 * @param mixed $default
899 * The default value to return if setting doesn't exist or is not set.
902 * The value of the requested setting, NULL if the setting does not exist.
904 * @deprecated Will be removed in a future release.
907 * // Before ("button_colorize" and "my_subtheme_custom_option").
908 * $colorize = bootstrap_setting('button_colorize', 'my_subtheme');
909 * $custom_option = bootstrap_setting('custom_option', 'my_subtheme', 'my_subtheme');
911 * // After ("button_colorize" and "my_subtheme_custom_option").
912 * use Drupal\bootstrap\Bootstrap;
913 * $my_subtheme = Bootstrap::getTheme('my_subtheme');
914 * $my_subtheme->getSetting('button_colorize');
915 * $my_subtheme->getSetting('my_subtheme_custom_option');
918 * @see \Drupal\bootstrap\Theme::getSetting()
919 * @see \Drupal\bootstrap\Bootstrap::getTheme()
921 function bootstrap_setting($name, $theme = NULL, $prefix = 'bootstrap', $default = NULL) {
922 Bootstrap::deprecated();
923 $theme = Bootstrap::getTheme($theme);
924 $prefix = $prefix !== 'bootstrap' && !empty($prefix) ? $prefix . '_' : '';
925 return $theme->getSetting($prefix . $name, $default);