Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions includes/utils.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,13 @@ function kalatheme_updater_info_alter(&$updaters) {
/**
* Loads all dependencies necessary for Kalatheme to operate.
*
* @param $display_errors
* Whether or not to display error messages when dependencies are not met.
*
* @return string
* Name of the function for kalatheme_status_messages to call
*/
function _kalatheme_load_dependencies() {
function _kalatheme_load_dependencies($display_errors = FALSE) {
// If we've already loaded dependencies, just return the correct function to
// call for status messages.
$dependencies_loaded = &drupal_static(__FUNCTION__);
Expand Down Expand Up @@ -67,7 +70,7 @@ function _kalatheme_load_dependencies() {
$panels = TRUE;
}
}
if (!$panels) {
if (!$panels && $display_errors) {
drupal_set_message(t('Kalatheme requires at least Panels 3.4.'), 'error');
}

Expand All @@ -82,7 +85,7 @@ function _kalatheme_load_dependencies() {
$jq = TRUE;
}
}
if (!$jq) {
if (!$jq && $display_errors) {
drupal_set_message(t('Kalatheme requires a 2.x version of JQuery Update that uses at least JQuery 1.7'), 'error');
}

Expand Down Expand Up @@ -116,7 +119,7 @@ function _kalatheme_load_dependencies() {
$boot = TRUE;
}
}
if (!$boot) {
if (!$boot && $display_errors) {
drupal_set_message(t('You do not have a Bootstrap library installed but that is ok! To get equipped either check out our <a href="@setup_guide">Start Up Guide</a> or run our <a href="@setup_url">Setup Wizard.</a>', array(
'@setup_guide' => 'https://drupal.org/node/2167149',
'@setup_url' => url('admin/appearance/kalasetup'),
Expand Down Expand Up @@ -147,9 +150,9 @@ function kalatheme_prepare_config_form(&$form) {
// Provide needed ajax wrappers
$form['actions']['submit']['#prefix'] = "<div id='kala-submit-change-title'>";
$form['actions']['submit']['#suffix'] = "</div>";

// Add custom submit and validate functions to handle custom bootstrap
// libraries. Note that because of https://www.drupal.org/node/943212 it's
// libraries. Note that because of https://www.drupal.org/node/943212 it's
// possible for this function to end up getting called before #submit exists.
if (isset($form['#submit'])) {
if (!in_array('kalatheme_custom_bootstrap_library_submit', $form['#submit'])) {
Expand All @@ -167,11 +170,11 @@ function kalatheme_prepare_config_form(&$form) {
else {
$form['#submit'][] = 'kalatheme_custom_bootstrap_library_submit';
}

if (!isset($form['#validate']) || isset($form['#validate']) && !in_array('kalatheme_custom_bootstrap_library_validate', $form['#validate'])) {
$form['#validate'][] = 'kalatheme_custom_bootstrap_library_validate';
}

return $form;
}

Expand Down Expand Up @@ -348,7 +351,7 @@ function kalatheme_backend_check() {
/**
* Check whether Kalatheme has write access to libraries and modules directories.
*
* This check indicates whether we have enough access to be able to use
* This check indicates whether we have enough access to be able to use
* authorize.php and the updater.
*
* @return boolean
Expand Down