From a1afa8a7336bf29d8cd4b409e815c6fc51af514f Mon Sep 17 00:00:00 2001
From: Mark Carver <mark.carver@me.com>
Date: Mon, 9 Nov 2015 13:38:17 -0600
Subject: [PATCH] Issue #2611770 by chegor, markcarver: Errors User error:
 Invalid placeholder

---
 includes/cdn.inc   | 26 +++++++++++++-------------
 theme-settings.php | 42 ++++++++++++++++--------------------------
 2 files changed, 29 insertions(+), 39 deletions(-)

diff --git a/includes/cdn.inc b/includes/cdn.inc
index fdda7f9..9ea825a 100644
--- a/includes/cdn.inc
+++ b/includes/cdn.inc
@@ -56,11 +56,11 @@ function bootstrap_cdn_provider($provider = NULL, $reset = FALSE) {
         'jsdelivr' => array(
           'api' => 'http://api.jsdelivr.com/v1/bootstrap/libraries',
           'title' => t('jsDelivr'),
-          'description' =>  t('<p style="background:#EB4C36"><a href="!jsdelivr" target="_blank"><img src="http://www.jsdelivr.com/img/logo-34.png" alt="jsDelivr Logo" /></a></p><p><a href="!jsdelivr" target="_blank">jsDelivr</a> is a free multi-CDN infrastructure that uses <a href="!maxcdn" target="_blank">MaxCDN</a>, <a href="!cloudflare" target="_blank">Cloudflare</a> and many others to combine their powers for the good of the open source community... <a href="!jsdelivr_about" target="_blank">read more</a></p>', array(
-            '!jsdelivr' => 'http://www.jsdelivr.com',
-            '!jsdelivr_about' => 'http://www.jsdelivr.com/about',
-            '!maxcdn' => 'http://www.maxcdn.com',
-            '!cloudflare' => 'http://www.cloudflare.com',
+          'description' => t('<p style="background:#EB4C36"><a href=":jsdelivr" target="_blank"><img src="http://www.jsdelivr.com/img/logo-34.png" alt="jsDelivr Logo" /></a></p><p><a href=":jsdelivr" target="_blank">jsDelivr</a> is a free multi-CDN infrastructure that uses <a href=":maxcdn" target="_blank">MaxCDN</a>, <a href=":cloudflare" target="_blank">Cloudflare</a> and many others to combine their powers for the good of the open source community... <a href=":jsdelivr_about" target="_blank">read more</a></p>', array(
+            ':jsdelivr' => 'http://www.jsdelivr.com',
+            ':jsdelivr_about' => 'http://www.jsdelivr.com/about',
+            ':maxcdn' => 'http://www.maxcdn.com',
+            ':cloudflare' => 'http://www.cloudflare.com',
           )),
         ),
       );
@@ -395,10 +395,10 @@ function bootstrap_cdn_provider_settings_form(&$form, FormStateInterface &$form_
     // Indicate there was an error retrieving the provider's API data.
     if (!empty($data['error']) || !empty($data['imported'])) {
       if (!empty($data['error'])) {
-        $element['#prefix'] .= '<div class="alert alert-danger messages error"><strong>' . t('ERROR') . ':</strong> ' . t('Unable to reach or parse the data provided by the @title API. Ensure the server this website is hosted on is able to initiate HTTP requests via <a href="!drupal_http_request" target="_blank">drupal_http_request()</a>. If the request consistently fails, it is likely that there are certain PHP functions that have been disabled by the hosting provider for security reasons. It is possible to manually copy and paste the contents of the following URL into the "Imported @title data" section below.<br /><br /><a href="!provider_api" target="_blank">!provider_api</a>.', array(
+        $element['#prefix'] .= '<div class="alert alert-danger messages error"><strong>' . t('ERROR') . ':</strong> ' . t('Unable to reach or parse the data provided by the @title API. Ensure the server this website is hosted on is able to initiate HTTP requests via <a href=":drupal_http_request" target="_blank">drupal_http_request()</a>. If the request consistently fails, it is likely that there are certain PHP functions that have been disabled by the hosting provider for security reasons. It is possible to manually copy and paste the contents of the following URL into the "Imported @title data" section below.<br /><br /><a href=":provider_api" target="_blank">:provider_api</a>.', array(
             '@title' => $data['title'],
-            '!provider_api' => $data['api'],
-            '!drupal_http_request' => 'https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_http_request/7',
+            ':provider_api' => $data['api'],
+            ':drupal_http_request' => 'https://api.drupal.org/api/drupal/includes%21common.inc/function/drupal_http_request/7',
           )) . '</div>';
       }
       $element['import'] = array(
@@ -406,8 +406,8 @@ function bootstrap_cdn_provider_settings_form(&$form, FormStateInterface &$form_
         '#title' => t('Imported @title data', array(
           '@title' => $data['title'],
         )),
-        '#description' => t('The provider will attempt to parse the data entered here each time it is saved. If no data has been entered, any saved files associated with this provider will be removed and the provider will again attempt to request the API data normally through the following URL: <a href="!provider_api" target="_blank">!provider_api</a>.', array(
-          '!provider_api' => $data['api'],
+        '#description' => t('The provider will attempt to parse the data entered here each time it is saved. If no data has been entered, any saved files associated with this provider will be removed and the provider will again attempt to request the API data normally through the following URL: <a href=":provider_api" target="_blank">:provider_api</a>.', array(
+          ':provider_api' => $data['api'],
         )),
         '#weight' => 10,
         '#collapsible' => TRUE,
@@ -502,9 +502,9 @@ function bootstrap_bootstrap_cdn_provider_jsdelivr_settings_form_alter(&$element
   $element['bootstrap_cdn_jsdelivr_theme'] = array(
     '#type' => 'select',
     '#title' => t('Theme'),
-    '#description' => t('Choose the example <a href="!bootstrap_theme" target="_blank">Bootstrap Theme</a> provided by Bootstrap or one of the many, many <a href="!bootswatch" target="_blank">Bootswatch</a> themes!', array(
-      '!bootswatch' => 'https://bootswatch.com',
-      '!bootstrap_theme' => 'http://getbootstrap.com/examples/theme/',
+    '#description' => t('Choose the example <a href=":bootstrap_theme" target="_blank">Bootstrap Theme</a> provided by Bootstrap or one of the many, many <a href=":bootswatch" target="_blank">Bootswatch</a> themes!', array(
+      ':bootswatch' => 'https://bootswatch.com',
+      ':bootstrap_theme' => 'http://getbootstrap.com/examples/theme/',
     )),
     '#default_value' => bootstrap_setting('cdn_jsdelivr_theme', $theme),
     '#options' => $themes,
diff --git a/theme-settings.php b/theme-settings.php
index 36627a4..e4c3192 100644
--- a/theme-settings.php
+++ b/theme-settings.php
@@ -60,8 +60,8 @@ function bootstrap_form_system_theme_settings_alter(&$form, FormStateInterface $
     '#type' => 'checkbox',
     '#title' => t('Fluid container'),
     '#default_value' => bootstrap_setting('fluid_container', $theme),
-    '#description' => t('Use <code>.container-fluid</code> class. See : !bootstrap_link', array(
-      '!bootstrap_link' => Drupal::l('Fluid container' , Url::fromUri('http://getbootstrap.com/css/' , ['absolute' => TRUE , 'fragment' => 'grid-example-fluid'])),
+    '#description' => t('Use <code>.container-fluid</code> class. See <a href=":url">Fluid container</a>', array(
+      ':url' => 'http://getbootstrap.com/css/#grid-example-fluid',
     )),
   );
 
@@ -87,17 +87,17 @@ function bootstrap_form_system_theme_settings_alter(&$form, FormStateInterface $
     '#type' => 'checkbox',
     '#title' => t('Colorize Buttons'),
     '#default_value' => bootstrap_setting('button_colorize', $theme),
-    '#description' => t('Adds classes to buttons based on their text value. See: !bootstrap_link and !api_link', array(
-      '!bootstrap_link' => Drupal::l(t('Buttons') , Url::fromUri('http://getbootstrap.com/css/#buttons')),
-      '!api_link' => Drupal::l('hook_bootstrap_colorize_text_alter()' , Url::fromUri('http://drupal-bootstrap.org/apis/hook_bootstrap_colorize_text_alter' , ['absolute' => TRUE])),
+    '#description' => t('Adds classes to buttons based on their text value. See: <a href=":bootstrap_url" target="_blank">Buttons</a> and <a href=":api_url" target="_blank">hook_bootstrap_colorize_text_alter()</a>', array(
+      ':bootstrap_url' => 'http://getbootstrap.com/css/#buttons',
+      ':api_url' => 'http://drupal-bootstrap.org/apis/hook_bootstrap_colorize_text_alter',
     )),
   );
   $form['general']['buttons']['bootstrap_button_iconize'] = array(
     '#type' => 'checkbox',
     '#title' => t('Iconize Buttons'),
     '#default_value' => bootstrap_setting('button_iconize', $theme),
-    '#description' => t('Adds icons to buttons based on the text value. See: !api_link', array(
-      '!api_link' => Drupal::l('hook_bootstrap_iconize_text_alter()' , Url::fromUri('http://drupal-bootstrap.org/apis/hook_bootstrap_iconize_text_alter' , ['absolute' => TRUE])),
+    '#description' => t('Adds icons to buttons based on the text value. See: <a href=":api_url" target="_blank">hook_bootstrap_iconize_text_alter()</a>', array(
+      ':api_url' => 'http://drupal-bootstrap.org/apis/hook_bootstrap_iconize_text_alter',
     )),
   );
 
@@ -153,8 +153,8 @@ function bootstrap_form_system_theme_settings_alter(&$form, FormStateInterface $
   $form['general']['images']['bootstrap_image_shape'] = array(
     '#type' => 'select',
     '#title' => t('Default image shape'),
-    '#description' => t('Add classes to an <code>&lt;img&gt;</code> element to easily style images in any project. Note: Internet Explorer 8 lacks support for rounded corners. See: !bootstrap_link', array(
-      '!bootstrap_link' => Drupal::l(t('Image Shapes') , Url::fromUri('http://getbootstrap.com/css/' , ['absolute' => TRUE , 'fragment' => 'images-shapes'])),
+    '#description' => t('Add classes to an <code>&lt;img&gt;</code> element to easily style images in any project. Note: Internet Explorer 8 lacks support for rounded corners. See: <a href=":bootstrap_url" target="_blank">Image Shapes</a>', array(
+      ':bootstrap_url' => 'http://getbootstrap.com/css/#images-shapes',
     )),
     '#default_value' => bootstrap_setting('image_shape', $theme),
     '#empty_option' => t('None'),
@@ -292,8 +292,8 @@ function bootstrap_form_system_theme_settings_alter(&$form, FormStateInterface $
   $form['components']['region_wells'] = array(
     '#type' => 'details',
     '#title' => t('Region wells'),
-    '#description' => t('Enable the <code>.well</code>, <code>.well-sm</code> or <code>.well-lg</code> classes for specified regions. See: documentation on !wells.', array(
-      '!wells' => \Drupal::l(t('Bootstrap Wells'), Url::fromUri('http://getbootstrap.com/components/#wells')),
+    '#description' => t('Enable the <code>.well</code>, <code>.well-sm</code> or <code>.well-lg</code> classes for specified regions. See: documentation on :wells.', array(
+      ':wells' => l(t('Bootstrap Wells'), 'http://getbootstrap.com/components/#wells'),
     )),
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
@@ -423,9 +423,9 @@ function bootstrap_form_system_theme_settings_alter(&$form, FormStateInterface $
   $form['javascript']['popovers']['options']['bootstrap_popover_selector'] = array(
     '#type' => 'textfield',
     '#title' => t('selector'),
-    '#description' => t('If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See !this and !example.', array(
-      '!this' => \Drupal::l(t('this'), Url::fromUri('https://github.com/twbs/bootstrap/issues/4215')),
-      '!example' => \Drupal::l(t('an informative example'), Url::fromUri('http://jsfiddle.net/fScua/')),
+    '#description' => t('If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to enable dynamic HTML content to have popovers added. See <a href=":this" target="_blank">this</a> and <a href=":example" target="_blank">an informative example</a>.', array(
+      ':this' => 'https://github.com/twbs/bootstrap/issues/4215',
+      ':example' => 'http://jsfiddle.net/fScua/',
     )),
     '#default_value' => bootstrap_setting('popover_selector', $theme),
   );
@@ -477,8 +477,8 @@ function bootstrap_form_system_theme_settings_alter(&$form, FormStateInterface $
   $form['javascript']['tooltips'] = array(
     '#type' => 'details',
     '#title' => t('Tooltips'),
-    '#description' => t("Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don't rely on images, use CSS3 for animations, and data-attributes for local title storage. See !link for more documentation.", array(
-      '!link' => \Drupal::l(t('Bootstrap tooltips'), Url::fromUri('http://getbootstrap.com/javascript/#tooltips')),
+    '#description' => t('Inspired by the excellent jQuery.tipsy plugin written by Jason Frame; Tooltips are an updated version, which don\'t rely on images, use CSS3 for animations, and data-attributes for local title storage. See <a href=":url" target="_blank">Bootstrap tooltips</a> for more documentation.', array(
+      ':url' => 'http://getbootstrap.com/javascript/#tooltips',
     )),
     '#collapsible' => TRUE,
     '#collapsed' => TRUE,
@@ -577,16 +577,6 @@ function bootstrap_form_system_theme_settings_alter(&$form, FormStateInterface $
     '#group' => 'bootstrap',
   );
 
-  // jQuery Update error suppression.
-  $form['advanced']['bootstrap_toggle_jquery_error'] = array(
-    '#type' => 'checkbox',
-    '#title' => t('Suppress jQuery version error message'),
-    '#default_value' => bootstrap_setting('toggle_jquery_error', $theme),
-    '#description' => t('Enable this if the version of jQuery has been upgraded to 1.9+ using a method other than the <a href="!jquery_update" target="_blank">jQuery Update</a> module.', array(
-      '!jquery_update' => 'https://drupal.org/project/jquery_update',
-    )),
-  );
-
   // BootstrapCDN.
   bootstrap_cdn_provider_settings_form($form, $form_state, $theme);
 }
-- 
2.4.9 (Apple Git-60)

