diff --git a/core/modules/contact/config/schema/contact.schema.yml b/core/modules/contact/config/schema/contact.schema.yml index 0ef4c2e..b656ad8 100644 --- a/core/modules/contact/config/schema/contact.schema.yml +++ b/core/modules/contact/config/schema/contact.schema.yml @@ -2,7 +2,7 @@ contact.category.*: type: config_entity - label: 'Contact category' + label: 'Contact form' mapping: id: type: string @@ -29,7 +29,7 @@ contact.settings: mapping: default_category: type: string - label: 'Default category identifier' + label: 'Default form identifier' flood: type: mapping label: 'Flood control' diff --git a/core/modules/contact/contact.local_actions.yml b/core/modules/contact/contact.local_actions.yml index c917e7f..551afee 100644 --- a/core/modules/contact/contact.local_actions.yml +++ b/core/modules/contact/contact.local_actions.yml @@ -1,6 +1,6 @@ contact.category_add: route_name: contact.category_add - title: 'Add category' + title: 'Add form' weight: 1 appears_on: - contact.category_list diff --git a/core/modules/contact/contact.menu_links.yml b/core/modules/contact/contact.menu_links.yml index 683be63..4345597 100644 --- a/core/modules/contact/contact.menu_links.yml +++ b/core/modules/contact/contact.menu_links.yml @@ -1,7 +1,7 @@ contact.category_list: - title: 'Contact form categories' + title: 'Contact forms' parent: system.admin_structure - description: 'Create a system contact form and set up categories for the form to use.' + description: 'Create a system contact form and set up other forms to use.' route_name: contact.category_list contact.site_page: title: Contact diff --git a/core/modules/contact/contact.module b/core/modules/contact/contact.module index e8485c1..3b72ae6 100644 --- a/core/modules/contact/contact.module +++ b/core/modules/contact/contact.module @@ -21,7 +21,7 @@ function contact_help($route_name, RouteMatchInterface $route_match) { $output .= '
' . t('Add one or more categories on this page to set up your site-wide contact form.', array('@form' => url('contact'))) . '
'; + $output = '' . t('Add one or more forms on this page to set up your site-wide contact form.', array('@form' => url('contact'))) . '
'; $output .= '' . t('A Contact menu item is added to the Footer menu, which you can modify on the Menus administration page.', array('@menu-settings' => url('admin/structure/menu'))) . '
'; $output .= '' . t('If you would like additional text to appear on the site-wide contact page, use a block. You can create and edit blocks on the Blocks administration page.', array('@blocks' => url('admin/structure/block'))) . '
'; return $output; diff --git a/core/modules/contact/contact.routing.yml b/core/modules/contact/contact.routing.yml index 45d800d..5d78d08 100644 --- a/core/modules/contact/contact.routing.yml +++ b/core/modules/contact/contact.routing.yml @@ -10,7 +10,7 @@ contact.category_list: path: '/admin/structure/contact' defaults: _entity_list: 'contact_category' - _title: 'Contact form categories' + _title: 'Contact forms' requirements: _permission: 'administer contact forms' @@ -18,7 +18,7 @@ contact.category_add: path: '/admin/structure/contact/add' defaults: _entity_form: 'contact_category.add' - _title: 'Add category' + _title: 'Add form' requirements: _permission: 'administer contact forms' @@ -26,7 +26,7 @@ contact.category_edit: path: '/admin/structure/contact/manage/{contact_category}' defaults: _entity_form: 'contact_category.edit' - _title: 'Edit contact category' + _title: 'Edit contact form' requirements: _entity_access: 'contact_category.update' @@ -42,7 +42,7 @@ contact.site_page: contact.site_page_category: path: '/contact/{contact_category}' defaults: - _title: 'Contact category form' + _title: 'Contact form' _content: '\Drupal\contact\Controller\ContactController::contactSitePage' requirements: _entity_access: 'contact_category.view' diff --git a/core/modules/contact/src/CategoryAccessController.php b/core/modules/contact/src/CategoryAccessController.php index f798d79..28e1544 100644 --- a/core/modules/contact/src/CategoryAccessController.php +++ b/core/modules/contact/src/CategoryAccessController.php @@ -23,11 +23,11 @@ class CategoryAccessController extends EntityAccessController { */ public function checkAccess(EntityInterface $entity, $operation, $langcode, AccountInterface $account) { if ($operation == 'view') { - // Do not allow access personal category via site-wide route. + // Do not allow access personal form via site-wide route. return $account->hasPermission('access site-wide contact form') && $entity->id() !== 'personal'; } elseif ($operation == 'delete' || $operation == 'update') { - // Do not allow the 'personal' category to be deleted, as it's used for + // Do not allow the 'personal' form to be deleted, as it's used for // the personal contact form. return $account->hasPermission('administer contact forms') && $entity->id() !== 'personal'; } diff --git a/core/modules/contact/src/CategoryForm.php b/core/modules/contact/src/CategoryForm.php index 2147698..fce5980 100644 --- a/core/modules/contact/src/CategoryForm.php +++ b/core/modules/contact/src/CategoryForm.php @@ -58,11 +58,11 @@ public function form(array $form, array &$form_state) { '#type' => 'weight', '#title' => t('Weight'), '#default_value' => $category->weight, - '#description' => t('When listing categories, those with lighter (smaller) weights get listed before categories with heavier (larger) weights. Categories with equal weights are sorted alphabetically.'), + '#description' => t('When listing forms, those with lighter (smaller) weights get listed before forms with heavier (larger) weights. Forms with equal weights are sorted alphabetically.'), ); $form['selected'] = array( '#type' => 'checkbox', - '#title' => t('Make this the default category.'), + '#title' => t('Make this the default form.'), '#default_value' => $default_category === $category->id(), ); $form['actions'] = array('#type' => 'actions'); diff --git a/core/modules/contact/src/CategoryInterface.php b/core/modules/contact/src/CategoryInterface.php index 0f3dd5b..65b1d03 100644 --- a/core/modules/contact/src/CategoryInterface.php +++ b/core/modules/contact/src/CategoryInterface.php @@ -10,7 +10,7 @@ use Drupal\Core\Config\Entity\ConfigEntityInterface; /** - * Provides an interface defining a contact category entity. + * Provides an interface defining a contact form entity. */ interface CategoryInterface extends ConfigEntityInterface { diff --git a/core/modules/contact/src/CategoryListBuilder.php b/core/modules/contact/src/CategoryListBuilder.php index 37169ff..2cfabc3 100644 --- a/core/modules/contact/src/CategoryListBuilder.php +++ b/core/modules/contact/src/CategoryListBuilder.php @@ -12,7 +12,7 @@ use Drupal\Core\Entity\EntityInterface; /** - * Defines a class to build a listing of contact category entities. + * Defines a class to build a listing of contact form entities. * * @see \Drupal\contact\Entity\Category */ @@ -22,7 +22,7 @@ class CategoryListBuilder extends ConfigEntityListBuilder { * {@inheritdoc} */ public function buildHeader() { - $header['category'] = t('Category'); + $header['category'] = t('Form'); $header['recipients'] = t('Recipients'); $header['selected'] = t('Selected'); return $header + parent::buildHeader(); @@ -33,7 +33,7 @@ public function buildHeader() { */ public function buildRow(EntityInterface $entity) { $row['category'] = $this->getLabel($entity); - // Special case the personal category. + // Special case the personal form. if ($entity->id() == 'personal') { $row['recipients'] = t('Selected user'); $row['selected'] = t('No'); diff --git a/core/modules/contact/src/Controller/ContactController.php b/core/modules/contact/src/Controller/ContactController.php index df720bc..97fcda5 100644 --- a/core/modules/contact/src/Controller/ContactController.php +++ b/core/modules/contact/src/Controller/ContactController.php @@ -51,14 +51,14 @@ public static function create(ContainerInterface $container) { * Presents the site-wide contact form. * * @param \Drupal\contact\CategoryInterface $contact_category - * The contact category to use. + * The contact form to use. * * @return array * The form as render array as expected by drupal_render(). * * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * Exception is thrown when user tries to access non existing default - * contact category form. + * contact form form. */ public function contactSitePage(CategoryInterface $contact_category = NULL) { // Check if flood control has been activated for sending emails. @@ -66,15 +66,15 @@ public function contactSitePage(CategoryInterface $contact_category = NULL) { $this->contactFloodControl(); } - // Use the default category if no category has been passed. + // Use the default form if no form has been passed. if (empty($contact_category)) { $contact_category = $this->entityManager() ->getStorage('contact_category') ->load($this->config('contact.settings')->get('default_category')); - // If there are no categories, do not display the form. + // If there are no forms, do not display the form. if (empty($contact_category)) { if ($this->currentUser()->hasPermission('administer contact forms')) { - drupal_set_message($this->t('The contact form has not been configured. Add one or more categories to the form.', array( + drupal_set_message($this->t('The contact form has not been configured. Add one or more form .', array( '@add' => $this->url('contact.category_add'))), 'error'); return array(); } diff --git a/core/modules/contact/src/Entity/Category.php b/core/modules/contact/src/Entity/Category.php index cc0e6d8..82219dd 100644 --- a/core/modules/contact/src/Entity/Category.php +++ b/core/modules/contact/src/Entity/Category.php @@ -13,11 +13,11 @@ use Drupal\contact\CategoryInterface; /** - * Defines the contact category entity. + * Defines the contact form entity. * * @ConfigEntityType( * id = "contact_category", - * label = @Translation("Contact category"), + * label = @Translation("Contact form"), * controllers = { * "access" = "Drupal\contact\CategoryAccessController", * "list_builder" = "Drupal\contact\CategoryListBuilder", @@ -43,14 +43,14 @@ class Category extends ConfigEntityBundleBase implements CategoryInterface { /** - * The category ID. + * The form ID. * * @var string */ public $id; /** - * The category label. + * The form label. * * @var string */ @@ -71,7 +71,7 @@ class Category extends ConfigEntityBundleBase implements CategoryInterface { public $reply = ''; /** - * Weight of this category (used for sorting). + * Weight of this form (used for sorting). * * @var int */ diff --git a/core/modules/contact/src/Entity/Message.php b/core/modules/contact/src/Entity/Message.php index d3c8c38..4d67a48 100644 --- a/core/modules/contact/src/Entity/Message.php +++ b/core/modules/contact/src/Entity/Message.php @@ -149,8 +149,8 @@ public function getPersonalRecipient() { */ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { $fields['category'] = FieldDefinition::create('entity_reference') - ->setLabel(t('Category ID')) - ->setDescription(t('The ID of the associated category.')) + ->setLabel(t('Form ID')) + ->setDescription(t('The ID of the associated form.')) ->setSetting('target_type', 'contact_category') ->setRequired(TRUE); diff --git a/core/modules/contact/src/Form/CategoryDeleteForm.php b/core/modules/contact/src/Form/CategoryDeleteForm.php index 799513a..be0bed7 100644 --- a/core/modules/contact/src/Form/CategoryDeleteForm.php +++ b/core/modules/contact/src/Form/CategoryDeleteForm.php @@ -11,7 +11,7 @@ use Drupal\Core\Url; /** - * Builds the form to delete a contact category. + * Builds the form to delete a contact form. */ class CategoryDeleteForm extends EntityConfirmFormBase { @@ -41,8 +41,8 @@ public function getConfirmText() { */ public function submit(array $form, array &$form_state) { $this->entity->delete(); - drupal_set_message(t('Category %label has been deleted.', array('%label' => $this->entity->label()))); - watchdog('contact', 'Category %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE); + drupal_set_message(t('Form %label has been deleted.', array('%label' => $this->entity->label()))); + watchdog('contact', 'Form %label has been deleted.', array('%label' => $this->entity->label()), WATCHDOG_NOTICE); $form_state['redirect_route'] = $this->getCancelRoute(); } diff --git a/core/modules/contact/src/MessageInterface.php b/core/modules/contact/src/MessageInterface.php index b73bd2d..d05ac32 100644 --- a/core/modules/contact/src/MessageInterface.php +++ b/core/modules/contact/src/MessageInterface.php @@ -15,10 +15,10 @@ interface MessageInterface extends ContentEntityInterface { /** - * Returns the category this contact message belongs to. + * Returns the form this contact message belongs to. * * @return \Drupal\contact\CategoryInterface - * The contact category entity. + * The contact form entity. */ public function getCategory(); diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php index 2be4208..eecce26 100644 --- a/core/modules/contact/src/Tests/ContactSitewideTest.php +++ b/core/modules/contact/src/Tests/ContactSitewideTest.php @@ -52,9 +52,9 @@ function testSiteWideContact() { $this->assertText(t('The configuration options have been saved.')); $this->drupalGet('admin/structure/contact'); - // Default category exists. + // Default form exists. $this->assertLinkByHref('admin/structure/contact/manage/feedback/delete'); - // User category could not be changed or deleted. + // User form could not be changed or deleted. // Cannot use ::assertNoLinkByHref as it does partial url matching and with // field_ui enabled admin/structure/contact/manage/personal/fields exists. // @todo: See https://drupal.org/node/2031223 for the above @@ -69,13 +69,13 @@ function testSiteWideContact() { $this->drupalGet('admin/structure/contact/manage/personal'); $this->assertResponse(403); - // Delete old categories to ensure that new categories are used. + // Delete old fiorms to ensure that new forms are used. $this->deleteCategories(); $this->drupalGet('admin/structure/contact'); - $this->assertText('Personal', 'Personal category was not deleted'); + $this->assertText('Personal', 'Personal form was not deleted'); $this->assertNoLinkByHref('admin/structure/contact/manage/feedback'); - // Ensure that the contact form won't be shown without categories. + // Ensure that the contact form won't be shown without forms. user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form')); $this->drupalLogout(); $this->drupalGet('contact'); @@ -85,11 +85,11 @@ function testSiteWideContact() { $this->drupalGet('contact'); $this->assertResponse(200); $this->assertText(t('The contact form has not been configured.')); - // Test access personal category via site-wide contact page. + // Test access personal form via site-wide contact page. $this->drupalGet('contact/personal'); $this->assertResponse(403); - // Add categories. + // Add forms. // Test invalid recipients. $invalid_recipients = array('invalid', 'invalid@', 'invalid@site.', '@site.', '@site.com'); foreach ($invalid_recipients as $invalid_recipient) { @@ -97,7 +97,7 @@ function testSiteWideContact() { $this->assertRaw(t('%recipient is an invalid email address.', array('%recipient' => $invalid_recipient))); } - // Test validation of empty category and recipients fields. + // Test validation of empty form and recipients fields. $this->addCategory('', '', '', '', TRUE); $this->assertText(t('Label field is required.')); $this->assertText(t('Machine-readable name field is required.')); @@ -110,53 +110,53 @@ function testSiteWideContact() { $this->addCategory($id = drupal_strtolower($this->randomName($max_length_exceeded)), $label = $this->randomName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE); $this->assertText(format_string('Machine-readable name cannot be longer than !max characters but is currently !exceeded characters long.', array('!max' => $max_length, '!exceeded' => $max_length_exceeded))); $this->addCategory($id = drupal_strtolower($this->randomName($max_length)), $label = $this->randomName($max_length), implode(',', array($recipients[0])), '', TRUE); - $this->assertRaw(t('Category %label has been added.', array('%label' => $label))); + $this->assertRaw(t('Form %label has been added.', array('%label' => $label))); - // Create first valid category. + // Create first valid form. $this->addCategory($id = drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($recipients[0])), '', TRUE); - $this->assertRaw(t('Category %label has been added.', array('%label' => $label))); + $this->assertRaw(t('Form %label has been added.', array('%label' => $label))); - // Check that the category was created in site default language. + // Check that the form was created in site default language. $langcode = \Drupal::config('contact.category.' . $id)->get('langcode'); $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->id; $this->assertEqual($langcode, $default_langcode); - // Make sure the newly created category is included in the list of categories. - $this->assertNoUniqueText($label, 'New category included in categories list.'); + // Make sure the newly created form is included in the list of forms. + $this->assertNoUniqueText($label, 'New form included in forms list.'); - // Test update contact form category. + // Test update contact form. $this->updateCategory($id, $label = $this->randomName(16), $recipients_str = implode(',', array($recipients[0], $recipients[1])), $reply = $this->randomName(30), FALSE); $config = \Drupal::config('contact.category.' . $id)->get(); $this->assertEqual($config['label'], $label); $this->assertEqual($config['recipients'], array($recipients[0], $recipients[1])); $this->assertEqual($config['reply'], $reply); $this->assertNotEqual($id, \Drupal::config('contact.settings')->get('default_category')); - $this->assertRaw(t('Category %label has been updated.', array('%label' => $label))); - // Ensure the label is displayed on the contact page for this category. + $this->assertRaw(t('Form %label has been updated.', array('%label' => $label))); + // Ensure the label is displayed on the contact page for this form. $this->drupalGet('contact/' . $id); $this->assertText($label); - // Reset the category back to be the default category. + // Reset the form back to be the default form. \Drupal::config('contact.settings')->set('default_category', $id)->save(); - // Ensure that the contact form is shown without a category selection input. + // Ensure that the contact form is shown without a form selection input. user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form')); $this->drupalLogout(); $this->drupalGet('contact'); $this->assertText(t('Your email address')); - $this->assertNoText(t('Category')); + $this->assertNoText(t('Form')); $this->drupalLogin($admin_user); - // Add more categories. + // Add more forms. $this->addCategory(drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE); - $this->assertRaw(t('Category %label has been added.', array('%label' => $label))); + $this->assertRaw(t('Form %label has been added.', array('%label' => $label))); $this->addCategory($name = drupal_strtolower($this->randomName(16)), $label = $this->randomName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE); - $this->assertRaw(t('Category %label has been added.', array('%label' => $label))); + $this->assertRaw(t('Form %label has been added.', array('%label' => $label))); - // Try adding a category that already exists. + // Try adding a form that already exists. $this->addCategory($name, $label, '', '', FALSE); - $this->assertNoRaw(t('Category %label has been saved.', array('%label' => $label))); + $this->assertNoRaw(t('Form %label has been saved.', array('%label' => $label))); $this->assertRaw(t('The machine-readable name is already in use. It must be unique.')); // Clear flood table in preparation for flood test and allow other checks to complete. @@ -231,7 +231,7 @@ function testSiteWideContact() { // Test field UI and field integration. $this->drupalGet('admin/structure/contact'); - // Find out in which row the category we want to add a field to is. + // Find out in which row the form we want to add a field to is. $i = 0; foreach($this->xpath('//table/tbody/tr') as $row) { if (((string)$row->td[0]) == $label) { @@ -280,7 +280,7 @@ function testAutoReply() { $admin_user = $this->drupalCreateUser(array('access site-wide contact form', 'administer contact forms', 'administer permissions', 'administer users')); $this->drupalLogin($admin_user); - // Set up three categories, 2 with an auto-reply and one without. + // Set up three forms, 2 with an auto-reply and one without. $foo_autoreply = $this->randomName(40); $bar_autoreply = $this->randomName(40); $this->addCategory('foo', 'foo', 'foo@example.com', $foo_autoreply, FALSE); @@ -291,7 +291,7 @@ function testAutoReply() { $this->drupalLogout(); user_role_grant_permissions(DRUPAL_ANONYMOUS_RID, array('access site-wide contact form')); - // Test the auto-reply for category 'foo'. + // Test the auto-reply for form 'foo'. $email = $this->randomName(32) . '@example.com'; $subject = $this->randomName(64); $this->submitContact($this->randomName(16), $email, $subject, 'foo', $this->randomString(128)); @@ -301,11 +301,11 @@ function testAutoReply() { $this->assertEqual(count($captured_emails), 1); $this->assertEqual(trim($captured_emails[0]['body']), trim(drupal_html_to_text($foo_autoreply))); - // Test the auto-reply for category 'bar'. + // Test the auto-reply for form 'bar'. $email = $this->randomName(32) . '@example.com'; $this->submitContact($this->randomName(16), $email, $this->randomString(64), 'bar', $this->randomString(128)); - // Auto-reply for category 'bar' should result in one auto-reply email to the sender. + // Auto-reply for form 'bar' should result in one auto-reply email to the sender. $captured_emails = $this->drupalGetMails(array('id' => 'contact_page_autoreply', 'to' => $email)); $this->assertEqual(count($captured_emails), 1); $this->assertEqual(trim($captured_emails[0]['body']), trim(drupal_html_to_text($bar_autoreply))); @@ -318,19 +318,19 @@ function testAutoReply() { } /** - * Adds a category. + * Adds a form. * * @param string $id - * The category machine name. + * The form machine name. * @param string $label - * The category label. + * The form label. * @param string $recipients * The list of recipient email addresses. * @param string $reply * The auto-reply text that is sent to a user upon completing the contact * form. * @param boolean $selected - * A Boolean indicating whether the category should be selected by default. + * A Boolean indicating whether the form should be selected by default. */ function addCategory($id, $label, $recipients, $reply, $selected) { $edit = array(); @@ -343,19 +343,19 @@ function addCategory($id, $label, $recipients, $reply, $selected) { } /** - * Updates a category. + * Updates a form. * * @param string $id - * The category machine name. + * The form machine name. * @param string $label - * The category label. + * The form label. * @param string $recipients * The list of recipient email addresses. * @param string $reply * The auto-reply text that is sent to a user upon completing the contact * form. * @param boolean $selected - * A Boolean indicating whether the category should be selected by default. + * A Boolean indicating whether the form should be selected by default. */ function updateCategory($id, $label, $recipients, $reply, $selected) { $edit = array(); @@ -395,20 +395,20 @@ function submitContact($name, $mail, $subject, $id, $message) { } /** - * Deletes all categories. + * Deletes all forms. */ function deleteCategories() { $categories = entity_load_multiple('contact_category'); foreach ($categories as $id => $category) { if ($id == 'personal') { - // Personal category could not be deleted. + // Personal form could not be deleted. $this->drupalGet("admin/structure/contact/manage/$id/delete"); $this->assertResponse(403); } else { $this->drupalPostForm("admin/structure/contact/manage/$id/delete", array(), t('Delete')); - $this->assertRaw(t('Category %label has been deleted.', array('%label' => $category->label()))); - $this->assertFalse(entity_load('contact_category', $id), format_string('Category %category not found', array('%category' => $category->label()))); + $this->assertRaw(t('Form %label has been deleted.', array('%label' => $category->label()))); + $this->assertFalse(entity_load('contact_category', $id), format_string('Form %category not found', array('%category' => $category->label()))); } } } diff --git a/core/modules/contact/src/Tests/Views/ContactFieldsTest.php b/core/modules/contact/src/Tests/Views/ContactFieldsTest.php index e6e70ad..94958b8 100644 --- a/core/modules/contact/src/Tests/Views/ContactFieldsTest.php +++ b/core/modules/contact/src/Tests/Views/ContactFieldsTest.php @@ -43,7 +43,7 @@ protected function setUp() { entity_create('contact_category', array( 'id' => 'contact_message', - 'label' => 'Test contact category', + 'label' => 'Test contact form', ))->save(); entity_create('field_instance_config', array( diff --git a/core/modules/contact/tests/drupal-7.contact.database.php b/core/modules/contact/tests/drupal-7.contact.database.php index ed8e5ba..cef89c2 100644 --- a/core/modules/contact/tests/drupal-7.contact.database.php +++ b/core/modules/contact/tests/drupal-7.contact.database.php @@ -9,13 +9,13 @@ * the database structure expected in tests altogether. */ -// Update the default category to that it is not selected. +// Update the default form to that it is not selected. db_update('contact') ->fields(array('selected' => '0')) ->condition('cid', '1') ->execute(); -// Add a custom contact category. +// Add a custom contact form. db_insert('contact')->fields(array( 'category', 'recipients',