Commit f0cf2a13 authored by APolitsin's avatar APolitsin
Browse files

Issue #3141836 by Project Update Bot: Automated Drupal Rector fixes

parent 45342de5
......@@ -13,9 +13,9 @@ class ContactMessagePresave {
public static function setTitle($entity) {
if (empty($entity->subject->getValue())) {
$formId = $entity->contact_form->getString();
$entityForm = \Drupal::entityManager()->getStorage('contact_form')->load($formId);
$entityForm = \Drupal::service('entity_type.manager')->getStorage('contact_form')->load($formId);
$formTitle = !empty($entityForm->get('label')) ? $entityForm->get('label') : t('Contact form');
$formTitle .= " - " . format_date(REQUEST_TIME, 'custom', 'dM H:i:s');
$formTitle .= " - " . \Drupal::service('date.formatter')->format(\Drupal::time()->getRequestTime(), 'custom', 'dM H:i:s');
$entity->subject->setValue($formTitle);
}
}
......
......@@ -21,7 +21,7 @@ class FormContactMessageFormAlter {
// Debug contact form.
if ($config->get('show-ids')) {
drupal_set_message($form_id);
\Drupal::messenger()->addStatus($form_id);
}
// Add ajax Callback.
if ($config->get('ya-counter') && $config->get('ya-goals')) {
......
......@@ -84,7 +84,7 @@ class FormFieldConfigEditFormAlter {
if (!empty($msg)) {
$msg[] = t("<small>@class</small>", ['@class' => __CLASS__]);
$message = implode("<br>", $msg);
drupal_set_message(Markup::create($message), 'warning');
\Drupal::messenger()->addWarning(Markup::create($message));
}
}
}
......
......@@ -17,7 +17,7 @@ class FormFieldUiFieldStorageAddFormAlter {
$type = substr($path, 30, -17);
$message = t("Use '@type' prefix for field machine-name! Example: field_[@type_position] for Position field.<br>
<small>@class</small>", ['@class' => __CLASS__, '@type' => $type]);
drupal_set_message(Markup::create($message), 'warning');
\Drupal::messenger()->addWarning(Markup::create($message));
}
}
......@@ -12,7 +12,7 @@ class FormMenuEditFormAlter {
*/
public static function hook(&$form, &$form_state, $form_id) {
$message = t("Some options have been hidden using @class", ['@class' => __CLASS__]);
drupal_set_message($message, 'warning');
\Drupal::messenger()->addWarning($message);
if ($form['id']['#default_value'] == 'main') {
$form['id']['#prefix'] = '<div class="element-hidden">';
$form['id']['#suffix'] = '</div>';
......
......@@ -18,7 +18,7 @@ class NodePresave {
public static function hook($node) {
// Set Node-title id empty.
if (!$node->title->value) {
$title = $node->getType() . " - " . format_date(REQUEST_TIME, 'long');
$title = $node->getType() . " - " . \Drupal::service('date.formatter')->format(\Drupal::time()->getRequestTime(), 'long');
$node->title->setValue($title);
}
}
......
......@@ -48,7 +48,7 @@ class PreprocessHtml {
if (substr($current_path, 0, 7) == '/admin/') {
$url = Url::fromUserInput('/admin/config/synapse/synhelper')->toString();
$message = t('<b>NO-INDEX Attention!</b> The site is not indexed by search engines. <a href="@href">OFF/ON indexation</a>!', ['@href' => $url]);
drupal_set_message(Markup::create($message), 'error');
\Drupal::messenger()->addError(Markup::create($message));
}
}
}
......
......@@ -2,6 +2,7 @@
namespace Drupal\synhelper\Service;
use Drupal\Core\File\FileSystemInterface;
use Drupal\commerce_product\Entity\ProductInterface;
use Drupal\Core\Entity\ContentEntityInterface;
use Drupal\Core\Entity\EntityTypeManagerInterface;
......@@ -316,7 +317,7 @@ class ContentImporter {
$file = reset($files);
if (!$file) {
$path = $this->contentPath . '/files/' . $filename;
$uri = file_unmanaged_copy($path, 'public://' . $filename, FILE_EXISTS_REPLACE);
$uri = file_unmanaged_copy($path, 'public://' . $filename, FileSystemInterface::EXISTS_REPLACE);
$file = $file_storage->create([
'filename' => $filename,
'uri' => $uri,
......
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