Commit 36152940 authored by andypost's avatar andypost Committed by larowlan

Issue #2742877 by andypost, malavya: Fix coding standard errors

parent fc117ede
......@@ -55,6 +55,7 @@ function contact_storage_form_contact_form_form_alter(&$form, FormStateInterface
];
$form['#entity_builders'][] = 'contact_storage_contact_form_form_builder';
}
/**
* Entity builder for the contact form edit form with third party options.
*
......@@ -128,7 +129,6 @@ function contact_storage_entity_base_field_info(EntityTypeInterface $entity_type
}
}
/**
* Implements hook_entity_base_field_info_alter().
*/
......@@ -179,7 +179,7 @@ function contact_storage_entity_operation_alter(array &$operations, EntityInterf
* Implements hook_entity_type_alter().
*/
function contact_storage_entity_type_alter(array &$entity_types) {
/** @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
/* @var $entity_types \Drupal\Core\Entity\EntityTypeInterface[] */
// Set the controller class for nodes to an alternate implementation of the
// Drupal\Core\Entity\EntityStorageInterface interface.
$entity_types['contact_message']->setStorageClass('\Drupal\Core\Entity\Sql\SqlContentEntityStorage');
......@@ -256,7 +256,7 @@ function contact_storage_mail_alter(&$message) {
$contact_message = $message['params']['contact_message'];
foreach ($contact_message->getFields() as $field) {
if ($field->getFieldDefinition()->getType() === 'contact_storage_options_email') {
// One of the Option email item fields. Add the recipient to the message.
// Add recipients to the message from the Option email field.
foreach ($field as $delta => $item) {
$label = $item->value;
// Obtain the email to add to the message, using the label.
......
<?php
/**
* @file
* Contains \Drupal\contact_storage\ContactFormViewBuilder.
*/
namespace Drupal\contact_storage;
use Drupal\Core\Config\Config;
......
<?php
/**
* @file
* Contains \Drupal\contact_storage\ContactMessageViewBuilder.
*/
namespace Drupal\contact_storage;
......
......@@ -5,7 +5,6 @@ namespace Drupal\contact_storage;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Entity\Routing\DefaultHtmlRouteProvider;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
/**
* Provides routes for contact messages and contact forms.
......
......@@ -7,14 +7,12 @@ use Drupal\Core\Config\ConfigEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
/**
* A subscriber invalidating the entity type definition cache when the settings
* page is saved.
* Invalidates the entity type definition cache when the settings are changed.
*/
class ContactStorageSettingsFormSave implements EventSubscriberInterface {
/**
* Invalidate the entity type definition cache whenever the settings are
* modified.
* Invalidates the entity type definition cache whenever settings are changed.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* The Event to process.
......
......@@ -126,9 +126,9 @@ class ContactFormCloneForm extends ContactFormEditForm {
// Clone the entity view display.
$display = EntityViewDisplay::load('contact_message.' . $original_id . '.default');
EntityViewDisplay::create([
'bundle' => $contact_form->id(),
'uuid' => NULL,
] + $display->toArray())->save();
'bundle' => $contact_form->id(),
'uuid' => NULL,
] + $display->toArray())->save();
// Redirect and show messge.
$form_state->setRedirect('entity.contact_form.edit_form', ['contact_form' => $contact_form->id()]);
......@@ -146,5 +146,4 @@ class ContactFormCloneForm extends ContactFormEditForm {
return $actions;
}
}
......@@ -36,7 +36,7 @@ class ContactStorageSettingsForm extends ConfigFormBase {
$form['send_html'] = array(
'#type' => 'checkbox',
'#title' => t('Send HTML'),
'#description' => t('Whether the mails should be sent as HTML. A module like <a href=\'https://www.drupal.org/project/swiftmailer\'>Swiftmailer</a> is needed for this feature. This has only been tested with the Swiftmailer module, other modules might not work out of the box and will not use the provided default template.'),
'#description' => t('Whether the mails should be sent as HTML. A module like <a href="https://www.drupal.org/project/swiftmailer">Swiftmailer</a> is needed for this feature. This has only been tested with the Swiftmailer module, other modules might not work out of the box and will not use the provided default template.'),
'#default_value' => $config->get('send_html'),
);
......
<?php
/**
* @file
* Contains \Drupal\contact_storage\MessageEditForm.
*/
namespace Drupal\contact_storage;
use Drupal\Core\Entity\ContentEntityForm;
......
<?php
/**
* @file
* Contains \Drupal\contact_storage\MessageViewsData.
*/
namespace Drupal\contact_storage;
......
......@@ -159,7 +159,7 @@ class OptionsEmailItem extends ListItemBase {
protected function allowedValuesString($values) {
$lines = array();
foreach ($values as $key => $value) {
$lines[] = $key . '|' . $value['value'] . '|' . $value['emails'];
$lines[] = $key . '|' . $value['value'] . '|' . $value['emails'];
}
return implode("\n", $lines);
}
......
<?php
/**
* @file
* Contains Drupal\contact_storage\Plugin\views\field\ContactForm.
*/
namespace Drupal\contact_storage\Plugin\views\field;
use Drupal\Core\Config\Entity\ConfigEntityStorageInterface;
......
<?php
/**
* @file
* Contains \Drupal\contact_storage\Tests\ContactStorageTest.
*/
namespace Drupal\contact_storage\Tests;
use Drupal\contact\Entity\ContactForm;
use Drupal\field_ui\Tests\FieldUiTestTrait;
......@@ -97,7 +93,7 @@ class ContactStorageTest extends ContactStorageTestBase {
$display_fields = array(
"The sender's name",
"The sender's email",
"Subject"
"Subject",
);
// Check that name, subject and mail are configurable on display.
......
<?php
/**
* @file
* Contains \Drupal\contact_storage\Tests\ContactStorageTestBase.
*/
namespace Drupal\contact_storage\Tests;
......
<?php
/**
* @file
* Contains \Drupal\contact_storage\Tests\ContactViewBuilderTest.
*/
namespace Drupal\contact_storage\Tests;
/**
......
<?php
/**
* @file
* Contains \Drupal\Tests\contact_storage\Kernel\ContactStorageFieldTest.
*/
namespace Drupal\Tests\contact_storage\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests contact_storage ID field.
*
* @group contact_storage
*/
class ContactStorageFieldTest extends KernelTestBase {
......
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