Loading custom_search.pages.inc +3 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * User page callbacks for the custom_search module. */ use Drupal\Component\Utility\String; use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Url; Loading Loading @@ -127,7 +127,7 @@ function custom_search_preprocess_search_result(&$variables) { $result = $variables['result']; $variables['url'] = check_url($result['link']); $variables['title'] = String::checkPlain($result['title']); $variables['title'] = SafeMarkup::checkPlain($result['title']); if (isset($result['language']) && $result['language'] != $language_interface->getId() && $result['language'] != LanguageInterface::LANGCODE_NOT_SPECIFIED) { $variables['title_attributes']['lang'] = $result['language']; $variables['content_attributes']['lang'] = $result['language']; Loading @@ -136,7 +136,7 @@ function custom_search_preprocess_search_result(&$variables) { if ($page_config) { $info = array(); if (!empty($result['plugin_id'])) { $info['plugin_id'] = String::checkPlain($result['plugin_id']); $info['plugin_id'] = SafeMarkup::checkPlain($result['plugin_id']); } if (!empty($result['type']) && in_array('type', $page_config['info'], TRUE)) { $info['type'] = $result['type']; Loading src/Form/CustomSearchBlockForm.php +14 −14 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ namespace Drupal\custom_search\Form; use Drupal\Component\Utility\String; use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\Unicode; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBase; Loading Loading @@ -83,14 +83,14 @@ class CustomSearchBlockForm extends FormBase { // Search box. $form['keys'] = array( '#type' => 'search', '#title' => String::checkPlain($config['search_box']['label']), '#title' => SafeMarkup::checkPlain($config['search_box']['label']), '#title_display' => $config['search_box']['label_visibility'] ? 'before' : 'invisible', '#size' => $config['search_box']['size'], '#maxlength' => $config['search_box']['max_length'], '#default_value' => '', '#placeholder' => array('title' => String::checkPlain($config['search_box']['placeholder'])), '#placeholder' => array('title' => SafeMarkup::checkPlain($config['search_box']['placeholder'])), '#attributes' => array( 'title' => String::checkPlain($config['search_box']['title']), 'title' => SafeMarkup::checkPlain($config['search_box']['title']), 'class' => array('custom_search-keys'), ), '#weight' => $config['search_box']['weight'], Loading @@ -114,7 +114,7 @@ class CustomSearchBlockForm extends FormBase { // If content types and other searches are combined, make an optgroup. if (count($others) && count($toptions) && $config['content']['selector']['type'] == 'select') { $search_page = entity_load('search_page', $config['content']['page']); $options[String::checkPlain($search_page->label())] = $toptions; $options[SafeMarkup::checkPlain($search_page->label())] = $toptions; } else { $options = $toptions; Loading @@ -122,7 +122,7 @@ class CustomSearchBlockForm extends FormBase { if (count($others)) { $other_pages = entity_load_multiple('search_page', $others); foreach ($others as $other) { $options['o-' . String::checkPlain($other_pages[$other]->id())] = String::checkPlain($other_pages[$other]->label()); $options['o-' . SafeMarkup::checkPlain($other_pages[$other]->id())] = SafeMarkup::checkPlain($other_pages[$other]->label()); } } if (count($options)) { Loading @@ -137,7 +137,7 @@ class CustomSearchBlockForm extends FormBase { $form['types'] = array( '#type' => $selector_type, '#multiple' => $multiple, '#title' => String::checkPlain($config['content']['selector']['label']), '#title' => SafeMarkup::checkPlain($config['content']['selector']['label']), '#title_display' => $config['content']['selector']['label_visibility'] ? 'before' : 'invisible', '#options' => $options, '#default_value' => ($selector_type == 'checkboxes') ? array('c-all') : 'c-all', Loading Loading @@ -167,7 +167,7 @@ class CustomSearchBlockForm extends FormBase { $vocabulary_depth = (!$config['taxonomy'][$vid]['depth']) ? NULL : $config['taxonomy'][$vid]['depth']; $terms = taxonomy_get_tree($vid, 0, $vocabulary_depth, TRUE); foreach ($terms as $term) { $termName = String::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); $termName = SafeMarkup::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); $options['c-' . $term->id()] = (Unicode::substr($config['taxonomy'][$vid]['type'], 0, 6) == 'select') ? str_repeat('-', $term->depth) . ' ' . $termName : $termName; } $selector_type = $config['taxonomy'][$vid]['type']; Loading @@ -181,7 +181,7 @@ class CustomSearchBlockForm extends FormBase { $form['vocabulary_' . $vid] = array( '#type' => $selector_type, '#multiple' => $multiple, '#title' => String::checkPlain($config['taxonomy'][$vid]['label']), '#title' => SafeMarkup::checkPlain($config['taxonomy'][$vid]['label']), '#title_display' => $config['taxonomy'][$vid]['label_visibility'] ? 'before' : 'invisible', '#options' => $options, '#default_value' => ($selector_type == 'checkboxes') ? array('c-all') : 'c-all', Loading Loading @@ -235,7 +235,7 @@ class CustomSearchBlockForm extends FormBase { $form['languages'] = array( '#type' => $selector_type, '#multiple' => $multiple, '#title' => String::checkPlain($config['languages']['selector']['label']), '#title' => SafeMarkup::checkPlain($config['languages']['selector']['label']), '#title_display' => $config['languages']['selector']['label_visibility'] ? 'before' : 'invisible', '#options' => $options, '#default_value' => ($selector_type == 'checkboxes') ? array('c-all') : 'c-all', Loading Loading @@ -272,7 +272,7 @@ class CustomSearchBlockForm extends FormBase { else { $form['paths'] = array( '#type' => $config['paths']['selector']['type'], '#title' => String::checkPlain($config['paths']['selector']['label']), '#title' => SafeMarkup::checkPlain($config['paths']['selector']['label']), '#title_display' => $config['paths']['selector']['label_visibility'] ? 'before' : 'invisible', '#options' => $options, '#default_value' => key($options), Loading @@ -291,7 +291,7 @@ class CustomSearchBlockForm extends FormBase { if ($config['criteria'][$c]['display']) { $form['criteria_' . $c] = array( '#type' => 'textfield', '#title' => String::checkPlain($config['criteria'][$c]['label']), '#title' => SafeMarkup::checkPlain($config['criteria'][$c]['label']), '#size' => 15, '#maxlength' => 255, '#weight' => $config['criteria'][$c]['weight'], Loading @@ -307,7 +307,7 @@ class CustomSearchBlockForm extends FormBase { $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => String::checkPlain($config['submit']['text']), '#value' => SafeMarkup::checkPlain($config['submit']['text']), // Prevent op from showing up in the query string. '#name' => '', '#weight' => $config['submit']['weight'], Loading @@ -316,7 +316,7 @@ class CustomSearchBlockForm extends FormBase { $form['actions']['submit']['#type'] = 'image_button'; $form['actions']['submit']['#src'] = $config['submit']['image_path']; $form['actions']['submit']['#attributes'] = array( 'alt' => String::checkPlain($config['submit']['text']), 'alt' => SafeMarkup::checkPlain($config['submit']['text']), 'class' => array('custom-search-button'), ); unset($form['actions']['submit']['#value']); Loading Loading
custom_search.pages.inc +3 −3 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ * User page callbacks for the custom_search module. */ use Drupal\Component\Utility\String; use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Url; Loading Loading @@ -127,7 +127,7 @@ function custom_search_preprocess_search_result(&$variables) { $result = $variables['result']; $variables['url'] = check_url($result['link']); $variables['title'] = String::checkPlain($result['title']); $variables['title'] = SafeMarkup::checkPlain($result['title']); if (isset($result['language']) && $result['language'] != $language_interface->getId() && $result['language'] != LanguageInterface::LANGCODE_NOT_SPECIFIED) { $variables['title_attributes']['lang'] = $result['language']; $variables['content_attributes']['lang'] = $result['language']; Loading @@ -136,7 +136,7 @@ function custom_search_preprocess_search_result(&$variables) { if ($page_config) { $info = array(); if (!empty($result['plugin_id'])) { $info['plugin_id'] = String::checkPlain($result['plugin_id']); $info['plugin_id'] = SafeMarkup::checkPlain($result['plugin_id']); } if (!empty($result['type']) && in_array('type', $page_config['info'], TRUE)) { $info['type'] = $result['type']; Loading
src/Form/CustomSearchBlockForm.php +14 −14 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ namespace Drupal\custom_search\Form; use Drupal\Component\Utility\String; use Drupal\Component\Utility\SafeMarkup; use Drupal\Component\Utility\Unicode; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\FormBase; Loading Loading @@ -83,14 +83,14 @@ class CustomSearchBlockForm extends FormBase { // Search box. $form['keys'] = array( '#type' => 'search', '#title' => String::checkPlain($config['search_box']['label']), '#title' => SafeMarkup::checkPlain($config['search_box']['label']), '#title_display' => $config['search_box']['label_visibility'] ? 'before' : 'invisible', '#size' => $config['search_box']['size'], '#maxlength' => $config['search_box']['max_length'], '#default_value' => '', '#placeholder' => array('title' => String::checkPlain($config['search_box']['placeholder'])), '#placeholder' => array('title' => SafeMarkup::checkPlain($config['search_box']['placeholder'])), '#attributes' => array( 'title' => String::checkPlain($config['search_box']['title']), 'title' => SafeMarkup::checkPlain($config['search_box']['title']), 'class' => array('custom_search-keys'), ), '#weight' => $config['search_box']['weight'], Loading @@ -114,7 +114,7 @@ class CustomSearchBlockForm extends FormBase { // If content types and other searches are combined, make an optgroup. if (count($others) && count($toptions) && $config['content']['selector']['type'] == 'select') { $search_page = entity_load('search_page', $config['content']['page']); $options[String::checkPlain($search_page->label())] = $toptions; $options[SafeMarkup::checkPlain($search_page->label())] = $toptions; } else { $options = $toptions; Loading @@ -122,7 +122,7 @@ class CustomSearchBlockForm extends FormBase { if (count($others)) { $other_pages = entity_load_multiple('search_page', $others); foreach ($others as $other) { $options['o-' . String::checkPlain($other_pages[$other]->id())] = String::checkPlain($other_pages[$other]->label()); $options['o-' . SafeMarkup::checkPlain($other_pages[$other]->id())] = SafeMarkup::checkPlain($other_pages[$other]->label()); } } if (count($options)) { Loading @@ -137,7 +137,7 @@ class CustomSearchBlockForm extends FormBase { $form['types'] = array( '#type' => $selector_type, '#multiple' => $multiple, '#title' => String::checkPlain($config['content']['selector']['label']), '#title' => SafeMarkup::checkPlain($config['content']['selector']['label']), '#title_display' => $config['content']['selector']['label_visibility'] ? 'before' : 'invisible', '#options' => $options, '#default_value' => ($selector_type == 'checkboxes') ? array('c-all') : 'c-all', Loading Loading @@ -167,7 +167,7 @@ class CustomSearchBlockForm extends FormBase { $vocabulary_depth = (!$config['taxonomy'][$vid]['depth']) ? NULL : $config['taxonomy'][$vid]['depth']; $terms = taxonomy_get_tree($vid, 0, $vocabulary_depth, TRUE); foreach ($terms as $term) { $termName = String::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); $termName = SafeMarkup::checkPlain(\Drupal::entityManager()->getTranslationFromContext($term)->label()); $options['c-' . $term->id()] = (Unicode::substr($config['taxonomy'][$vid]['type'], 0, 6) == 'select') ? str_repeat('-', $term->depth) . ' ' . $termName : $termName; } $selector_type = $config['taxonomy'][$vid]['type']; Loading @@ -181,7 +181,7 @@ class CustomSearchBlockForm extends FormBase { $form['vocabulary_' . $vid] = array( '#type' => $selector_type, '#multiple' => $multiple, '#title' => String::checkPlain($config['taxonomy'][$vid]['label']), '#title' => SafeMarkup::checkPlain($config['taxonomy'][$vid]['label']), '#title_display' => $config['taxonomy'][$vid]['label_visibility'] ? 'before' : 'invisible', '#options' => $options, '#default_value' => ($selector_type == 'checkboxes') ? array('c-all') : 'c-all', Loading Loading @@ -235,7 +235,7 @@ class CustomSearchBlockForm extends FormBase { $form['languages'] = array( '#type' => $selector_type, '#multiple' => $multiple, '#title' => String::checkPlain($config['languages']['selector']['label']), '#title' => SafeMarkup::checkPlain($config['languages']['selector']['label']), '#title_display' => $config['languages']['selector']['label_visibility'] ? 'before' : 'invisible', '#options' => $options, '#default_value' => ($selector_type == 'checkboxes') ? array('c-all') : 'c-all', Loading Loading @@ -272,7 +272,7 @@ class CustomSearchBlockForm extends FormBase { else { $form['paths'] = array( '#type' => $config['paths']['selector']['type'], '#title' => String::checkPlain($config['paths']['selector']['label']), '#title' => SafeMarkup::checkPlain($config['paths']['selector']['label']), '#title_display' => $config['paths']['selector']['label_visibility'] ? 'before' : 'invisible', '#options' => $options, '#default_value' => key($options), Loading @@ -291,7 +291,7 @@ class CustomSearchBlockForm extends FormBase { if ($config['criteria'][$c]['display']) { $form['criteria_' . $c] = array( '#type' => 'textfield', '#title' => String::checkPlain($config['criteria'][$c]['label']), '#title' => SafeMarkup::checkPlain($config['criteria'][$c]['label']), '#size' => 15, '#maxlength' => 255, '#weight' => $config['criteria'][$c]['weight'], Loading @@ -307,7 +307,7 @@ class CustomSearchBlockForm extends FormBase { $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', '#value' => String::checkPlain($config['submit']['text']), '#value' => SafeMarkup::checkPlain($config['submit']['text']), // Prevent op from showing up in the query string. '#name' => '', '#weight' => $config['submit']['weight'], Loading @@ -316,7 +316,7 @@ class CustomSearchBlockForm extends FormBase { $form['actions']['submit']['#type'] = 'image_button'; $form['actions']['submit']['#src'] = $config['submit']['image_path']; $form['actions']['submit']['#attributes'] = array( 'alt' => String::checkPlain($config['submit']['text']), 'alt' => SafeMarkup::checkPlain($config['submit']['text']), 'class' => array('custom-search-button'), ); unset($form['actions']['submit']['#value']); Loading