updated core to 8.6.1 via composer

This commit is contained in:
2018-09-12 13:58:26 +02:00
parent a9a219f2ed
commit ea56b9fba3
4443 changed files with 112098 additions and 40708 deletions
@@ -24,7 +24,7 @@ class ContactPageAccess implements AccessInterface {
/**
* The user data service.
*
* @var \Drupal\user\UserDataInterface;
* @var \Drupal\user\UserDataInterface
*/
protected $userData;
@@ -2,7 +2,6 @@
namespace Drupal\contact;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Entity\EntityForm;
@@ -150,7 +149,7 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf
$form_state->setValue('recipients', $recipients);
$redirect_url = $form_state->getValue('redirect');
if ($redirect_url && $this->pathValidator->isValid($redirect_url)) {
if (Unicode::substr($redirect_url, 0, 1) !== '/') {
if (mb_substr($redirect_url, 0, 1) !== '/') {
$form_state->setErrorByName('redirect', $this->t('The path should start with /.'));
}
}
@@ -167,11 +166,11 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf
$edit_link = $this->entity->link($this->t('Edit'));
$view_link = $contact_form->link($contact_form->label(), 'canonical');
if ($status == SAVED_UPDATED) {
drupal_set_message($this->t('Contact form %label has been updated.', ['%label' => $view_link]));
$this->messenger()->addStatus($this->t('Contact form %label has been updated.', ['%label' => $view_link]));
$this->logger('contact')->notice('Contact form %label has been updated.', ['%label' => $contact_form->label(), 'link' => $edit_link]);
}
else {
drupal_set_message($this->t('Contact form %label has been added.', ['%label' => $view_link]));
$this->messenger()->addStatus($this->t('Contact form %label has been added.', ['%label' => $view_link]));
$this->logger('contact')->notice('Contact form %label has been added.', ['%label' => $contact_form->label(), 'link' => $edit_link]);
}
@@ -47,7 +47,8 @@ class ContactController extends ControllerBase {
* The contact form to use.
*
* @return array
* The form as render array as expected by drupal_render().
* The form as render array as expected by
* \Drupal\Core\Render\RendererInterface::render().
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* Exception is thrown when user tries to access non existing default
@@ -64,9 +65,9 @@ class ContactController extends ControllerBase {
// If there are no forms, do not display the form.
if (empty($contact_form)) {
if ($this->currentUser()->hasPermission('administer contact forms')) {
drupal_set_message($this->t('The contact form has not been configured. <a href=":add">Add one or more forms</a> .', [
$this->messenger()->addError($this->t('The contact form has not been configured. <a href=":add">Add one or more forms</a> .', [
':add' => $this->url('contact.form_add'),
]), 'error');
]));
return [];
}
else {
@@ -95,7 +96,8 @@ class ContactController extends ControllerBase {
* The account for which a personal contact form should be generated.
*
* @return array
* The personal contact form as render array as expected by drupal_render().
* The personal contact form as render array as expected by
* \Drupal\Core\Render\RendererInterface::render().
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* Exception is thrown when user tries to access a contact form for a
@@ -12,6 +12,13 @@ use Drupal\Core\Url;
* @ConfigEntityType(
* id = "contact_form",
* label = @Translation("Contact form"),
* label_collection = @Translation("Contact forms"),
* label_singular = @Translation("contact form"),
* label_plural = @Translation("contact forms"),
* label_count = @PluralTranslation(
* singular = "@count contact form",
* plural = "@count contact forms",
* ),
* handlers = {
* "access" = "Drupal\contact\ContactFormAccessControlHandler",
* "list_builder" = "Drupal\contact\ContactFormListBuilder",
@@ -13,6 +13,13 @@ use Drupal\Core\Field\BaseFieldDefinition;
* @ContentEntityType(
* id = "contact_message",
* label = @Translation("Contact message"),
* label_collection = @Translation("Contact messages"),
* label_singular = @Translation("contact message"),
* label_plural = @Translation("contact messages"),
* label_count = @PluralTranslation(
* singular = "@count contact message",
* plural = "@count contact messages",
* ),
* bundle_label = @Translation("Contact form"),
* handlers = {
* "access" = "Drupal\contact\ContactMessageAccessControlHandler",
+3 -3
View File
@@ -134,16 +134,16 @@ class MailHandler implements MailHandlerInterface {
if (!$message->isPersonal()) {
$this->logger->notice('%sender-name (@sender-from) sent an email regarding %contact_form.', [
'%sender-name' => $sender_cloned->getUsername(),
'%sender-name' => $sender_cloned->getAccountName(),
'@sender-from' => $sender_cloned->getEmail(),
'%contact_form' => $contact_form->label(),
]);
}
else {
$this->logger->notice('%sender-name (@sender-from) sent %recipient-name an email.', [
'%sender-name' => $sender_cloned->getUsername(),
'%sender-name' => $sender_cloned->getAccountName(),
'@sender-from' => $sender_cloned->getEmail(),
'%recipient-name' => $message->getPersonalRecipient()->getUsername(),
'%recipient-name' => $message->getPersonalRecipient()->getAccountName(),
]);
}
}
+8 -8
View File
@@ -5,7 +5,7 @@ namespace Drupal\contact;
use Drupal\Component\Datetime\TimeInterface;
use Drupal\Core\Datetime\DateFormatterInterface;
use Drupal\Core\Entity\ContentEntityForm;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Entity\EntityRepositoryInterface;
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
use Drupal\Core\Flood\FloodInterface;
use Drupal\Core\Form\FormStateInterface;
@@ -57,8 +57,8 @@ class MessageForm extends ContentEntityForm {
/**
* Constructs a MessageForm object.
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
* The entity repository.
* @param \Drupal\Core\Flood\FloodInterface $flood
* The flood control mechanism.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
@@ -72,8 +72,8 @@ class MessageForm extends ContentEntityForm {
* @param \Drupal\Component\Datetime\TimeInterface $time
* The time service.
*/
public function __construct(EntityManagerInterface $entity_manager, FloodInterface $flood, LanguageManagerInterface $language_manager, MailHandlerInterface $mail_handler, DateFormatterInterface $date_formatter, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) {
parent::__construct($entity_manager, $entity_type_bundle_info, $time);
public function __construct(EntityRepositoryInterface $entity_repository, FloodInterface $flood, LanguageManagerInterface $language_manager, MailHandlerInterface $mail_handler, DateFormatterInterface $date_formatter, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) {
parent::__construct($entity_repository, $entity_type_bundle_info, $time);
$this->flood = $flood;
$this->languageManager = $language_manager;
$this->mailHandler = $mail_handler;
@@ -85,7 +85,7 @@ class MessageForm extends ContentEntityForm {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('entity.manager'),
$container->get('entity.repository'),
$container->get('flood'),
$container->get('language_manager'),
$container->get('contact.mail_handler'),
@@ -109,7 +109,7 @@ class MessageForm extends ContentEntityForm {
'#theme_wrappers' => ['container__preview'],
'#attributes' => ['class' => ['preview']],
];
$form['preview']['message'] = $this->entityManager->getViewBuilder('contact_message')->view($message, 'full');
$form['preview']['message'] = $this->entityTypeManager->getViewBuilder('contact_message')->view($message, 'full');
}
$form['name'] = [
@@ -224,7 +224,7 @@ class MessageForm extends ContentEntityForm {
$this->flood->register('contact', $this->config('contact.settings')->get('flood.interval'));
if ($submission_message = $contact_form->getMessage()) {
drupal_set_message($submission_message);
$this->messenger()->addStatus($submission_message);
}
// To avoid false error messages caused by flood control, redirect away from