Commit 2cfe1894 authored by catch's avatar catch

Issue #2204143 by ianthomas_uk, sun: Remove deprecated drupal_explode_tags()...

Issue #2204143 by ianthomas_uk, sun: Remove deprecated drupal_explode_tags() and drupal_implode_tags().
parent ca104f64
......@@ -7,6 +7,7 @@
namespace Drupal\comment\Plugin\Action;
use Drupal\Component\Utility\Tags;
use Drupal\Core\Action\ConfigurableActionBase;
use Drupal\comment\CommentInterface;
......@@ -53,7 +54,7 @@ public function buildConfigurationForm(array $form, array &$form_state) {
'#title' => t('Keywords'),
'#type' => 'textarea',
'#description' => t('The comment will be unpublished if it contains any of the phrases above. Use a case-sensitive, comma-separated list of phrases. Example: funny, bungee jumping, "Company, Inc."'),
'#default_value' => drupal_implode_tags($this->configuration['keywords']),
'#default_value' => Tags::implode($this->configuration['keywords']),
);
return $form;
}
......@@ -62,7 +63,7 @@ public function buildConfigurationForm(array $form, array &$form_state) {
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, array &$form_state) {
$this->configuration['keywords'] = drupal_explode_tags($form_state['values']['keywords']);
$this->configuration['keywords'] = Tags::explode($form_state['values']['keywords']);
}
}
......@@ -7,6 +7,7 @@
namespace Drupal\entity_reference;
use Drupal\Component\Utility\Tags;
use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
......@@ -81,14 +82,14 @@ public function handleAutocomplete(Request $request, $type, $field_name, $entity
// Get the typed string, if exists from the URL.
$items_typed = $request->query->get('q');
$items_typed = drupal_explode_tags($items_typed);
$items_typed = Tags::explode($items_typed);
$last_item = drupal_strtolower(array_pop($items_typed));
$prefix = '';
// The user entered a comma-separated list of entity labels, so we generate
// a prefix.
if ($type == 'tags' && !empty($last_item)) {
$prefix = count($items_typed) ? drupal_implode_tags($items_typed) . ', ' : '';
$prefix = count($items_typed) ? Tags::implode($items_typed) . ', ' : '';
}
$matches = $this->entityReferenceAutocomplete->getMatches($instance->getField(), $instance, $entity_type, $entity_id, $prefix, $last_item);
......
......@@ -7,6 +7,8 @@
namespace Drupal\entity_reference\Plugin\Field\FieldWidget;
use Drupal\Component\Utility\Tags;
/**
* Plugin implementation of the 'entity_reference autocomplete-tags' widget.
*
......@@ -40,7 +42,7 @@ public function elementValidate($element, &$form_state, $form) {
if (!empty($element['#value'])) {
$value = array();
foreach (drupal_explode_tags($element['#value']) as $input) {
foreach (Tags::explode($element['#value']) as $input) {
$match = FALSE;
// Take "label (entity id)', match the ID from parenthesis when it's a
......
......@@ -7,6 +7,7 @@
namespace Drupal\node\Plugin\Action;
use Drupal\Component\Utility\Tags;
use Drupal\Core\Action\ConfigurableActionBase;
/**
......@@ -51,7 +52,7 @@ public function buildConfigurationForm(array $form, array &$form_state) {
'#title' => t('Keywords'),
'#type' => 'textarea',
'#description' => t('The content will be unpublished if it contains any of the phrases above. Use a case-sensitive, comma-separated list of phrases. Example: funny, bungee jumping, "Company, Inc."'),
'#default_value' => drupal_implode_tags($this->configuration['keywords']),
'#default_value' => Tags::implode($this->configuration['keywords']),
);
return $form;
}
......@@ -60,7 +61,7 @@ public function buildConfigurationForm(array $form, array &$form_state) {
* {@inheritdoc}
*/
public function submitConfigurationForm(array &$form, array &$form_state) {
$this->configuration['keywords'] = drupal_explode_tags($form_state['values']['keywords']);
$this->configuration['keywords'] = Tags::explode($form_state['values']['keywords']);
}
}
......@@ -170,7 +170,7 @@ function testNodeTermCreationAndDeletion() {
$edit['body[0][value]'] = $this->randomName();
// Insert the terms in a comma separated list. Vocabulary 1 is a
// free-tagging field created by the default profile.
$edit[$instance->getName()] = drupal_implode_tags($terms);
$edit[$instance->getName()] = Tags::implode($terms);
// Verify the placeholder is there.
$this->drupalGet('node/add/article');
......
......@@ -748,7 +748,7 @@ function taxonomy_file_download_access($field, EntityInterface $entity, FileInte
/**
* Implodes a list of tags of a certain vocabulary into a string.
*
* @see drupal_explode_tags()
* @see \Drupal\Component\Utility\Tags::explode()
*/
function taxonomy_implode_tags($tags, $vid = NULL) {
$typed_tags = array();
......@@ -794,7 +794,7 @@ function taxonomy_autocomplete_validate($element, &$form_state) {
// @see \Drupal\taxonomy\Plugin\Field\FieldWidget\TaxonomyAutocompleteWidget:massageFormValues()
$typed_terms = array();
if ($tags = $element['#value']) {
$typed_terms = drupal_explode_tags($tags);
$typed_terms = Tags::explode($tags);
}
form_set_value($element, $typed_terms, $form_state);
}
......
......@@ -7,6 +7,7 @@
namespace Drupal\user\Plugin\views\filter;
use Drupal\Component\Utility\Tags;
use Drupal\views\Plugin\views\filter\InOperator;
/**
......@@ -50,7 +51,7 @@ protected function valueForm(&$form, &$form_state) {
}
protected function valueValidate($form, &$form_state) {
$values = drupal_explode_tags($form_state['values']['options']['value']);
$values = Tags::explode($form_state['values']['options']['value']);
$uids = $this->validate_user_strings($form['value'], $form_state, $values);
if ($uids) {
......@@ -88,7 +89,7 @@ public function validateExposed(&$form, &$form_state) {
$input = $this->options['group_info']['group_items'][$input]['value'];
}
$values = drupal_explode_tags($input);
$values = Tags::explode($input);
if (!$this->options['is_grouped'] || ($this->options['is_grouped'] && ($input != 'All'))) {
$uids = $this->validate_user_strings($form[$identifier], $form_state, $values);
......
......@@ -6,6 +6,7 @@
*/
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\Tags;
use Drupal\views\ViewExecutable;
use Drupal\views\Views;
......@@ -235,7 +236,7 @@ function views_ui_taxonomy_autocomplete_validate($element, &$form_state) {
}
}
// Store the term ID of each (valid) tag that the user typed.
$typed_terms = drupal_explode_tags($tags);
$typed_terms = Tags::explode($tags);
foreach ($typed_terms as $typed_term) {
if ($terms = entity_load_multiple_by_properties('taxonomy_term', array('name' => trim($typed_term), 'vid' => array_keys($vocabularies)))) {
$term = array_pop($terms);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment