/** * Implements hook_form_FORM_ID_alter(). */ function bootstrap_form_system_theme_settings_alter(&$form, $form_state, $form_id = NULL) { // Work-around for a core bug affecting admin themes. // @see https://drupal.org/node/943212 if (isset($form_id)) { return; } // Include theme settings file. bootstrap_include('bootstrap', 'theme/settings.inc'); // Alter theme settings form. _bootstrap_settings_form($form, $form_state); }
/** * Returns HTML for a webform element. * * @see theme_webform_element() * @see bootstrap_form_element() */ function bootstrap_webform_element(&$variables) { $element =& $variables['element']; // Inline title. if ($element['#title_display'] === 'inline') { $element['#title_display'] = 'before'; $element['#wrapper_attributes']['class'][] = 'form-inline'; } // Description above field. if (!empty($element['#webform_component']['extra']['description_above'])) { $element['#description_display'] = 'before'; } // If field prefix or suffix is present, make this an input group. if (!empty($element['#field_prefix']) || !empty($element['#field_suffix'])) { $element['#input_group'] = TRUE; } // Render with bootstrap_form_element(). bootstrap_include('bootstrap', 'templates/system/form-element.func.php'); return bootstrap_form_element($variables); }
/** * Implements hook_theme(). * * Register theme hook implementations. * * The implementations declared by this hook have two purposes: either they * specify how a particular render array is to be rendered as HTML (this is * usually the case if the theme function is assigned to the render array's * #theme property), or they return the HTML that should be returned by an * invocation of theme(). * * @see _bootstrap_theme() */ function bootstrap_theme(&$existing, $type, $theme, $path) { bootstrap_include($theme, 'includes/registry.inc'); return _bootstrap_theme($existing, $type, $theme, $path); }
/** * Pre-processes variables for the "views_view_table" theme hook. * * See template for list of available variables. * * @see views-view-table.tpl.php * * @ingroup theme_preprocess */ function bootstrap_preprocess_views_view_table(&$variables) { bootstrap_include('bootstrap', 'templates/system/table.vars.php'); _bootstrap_table_add_classes($variables['classes_array'], $variables); }
* @file * theme-settings.php * * Provides theme settings for Bootstrap based themes when admin theme is not. * * @see ./includes/settings.inc */ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Url; use Drupal\Component\Serialization\Json; use GuzzleHttp\Exception\RequestException; /** * Include common Bootstrap functions. */ include_once dirname(__FILE__) . '/includes/common.inc'; bootstrap_include('bootstrap', 'includes/cdn.inc'); /** * Implements hook_form_FORM_ID_alter(). */ function bootstrap_form_system_theme_settings_alter(&$form, FormStateInterface $form_state, $form_id = NULL) { // Do not add Bootstrap specific settings to non-bootstrap based themes, // including a work-around for a core bug affecting admin themes. // @see https://drupal.org/node/943212 $args = $form_state->getBuildInfo()['args']; // Do not add Bootstrap specific settings to non-bootstrap based themes. $theme = !empty($args[0]) ? $args[0] : FALSE; if (isset($form_id) || $theme === FALSE || !in_array('bootstrap', _bootstrap_get_base_themes($theme, TRUE))) { return; } $form['bootstrap'] = array('#type' => 'vertical_tabs', '#attached' => array('library' => array('bootstrap/adminscript')), '#prefix' => '<h2><small>' . t('Bootstrap Settings') . '</small></h2>', '#weight' => -10);