Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176
This commit is contained in:
commit
9921556621
13277 changed files with 1459781 additions and 0 deletions
|
@ -0,0 +1,9 @@
|
|||
# Schema for configuration files of the Contact Storage Test module.
|
||||
|
||||
contact.form.*.third_party.contact_storage_test:
|
||||
type: mapping
|
||||
label: 'Per-contact form storage settings'
|
||||
mapping:
|
||||
send_a_pony:
|
||||
type: boolean
|
||||
label: 'Send a Pony'
|
|
@ -0,0 +1,9 @@
|
|||
name: 'Contact test storage'
|
||||
type: module
|
||||
description: 'Tests that contact messages can be stored.'
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- contact
|
||||
- user
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains install and update hooks.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Implements hook_install().
|
||||
*/
|
||||
function contact_storage_test_install() {
|
||||
$entity_manager = \Drupal::entityManager();
|
||||
$entity_type = $entity_manager->getDefinition('contact_message');
|
||||
|
||||
// Recreate the original entity type definition, in order to notify the
|
||||
// manager of what changed. The change of storage backend will trigger
|
||||
// schema installation.
|
||||
// @see contact_storage_test_entity_type_alter()
|
||||
$original = clone $entity_type;
|
||||
$original->setStorageClass('Drupal\Core\Entity\ContentEntityNullStorage');
|
||||
|
||||
$entity_manager->onEntityTypeUpdate($entity_type, $original);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains custom contact message functionality for ContactStorageTest.
|
||||
*/
|
||||
|
||||
use Drupal\contact\ContactFormInterface;
|
||||
use Drupal\Core\Field\BaseFieldDefinition;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_entity_base_field_info().
|
||||
*/
|
||||
function contact_storage_test_entity_base_field_info(\Drupal\Core\Entity\EntityTypeInterface $entity_type) {
|
||||
if ($entity_type->id() == 'contact_message') {
|
||||
$fields = array();
|
||||
|
||||
$fields['id'] = BaseFieldDefinition::create('integer')
|
||||
->setLabel(t('Message ID'))
|
||||
->setDescription(t('The message ID.'))
|
||||
->setReadOnly(TRUE)
|
||||
->setSetting('unsigned', TRUE);
|
||||
|
||||
return $fields;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_entity_type_alter().
|
||||
*/
|
||||
function contact_storage_test_entity_type_alter(array &$entity_types) {
|
||||
/** @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');
|
||||
$keys = $entity_types['contact_message']->getKeys();
|
||||
$keys['id'] = 'id';
|
||||
$entity_types['contact_message']->set('entity_keys', $keys);
|
||||
$entity_types['contact_message']->set('base_table', 'contact_message');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter() for contact_form_form().
|
||||
*/
|
||||
function contact_storage_test_form_contact_form_form_alter(&$form, FormStateInterface $form_state) {
|
||||
/** @var \Drupal\contact\ContactFormInterface $contact_form */
|
||||
$contact_form = $form_state->getFormObject()->getEntity();
|
||||
$form['send_a_pony'] = array(
|
||||
'#type' => 'checkbox',
|
||||
'#title' => t('Send submitters a voucher for a free pony.'),
|
||||
'#description' => t('Enable to send an additional email with a free pony voucher to anyone who submits the form.'),
|
||||
'#default_value' => $contact_form->getThirdPartySetting('contact_storage_test', 'send_a_pony', FALSE),
|
||||
);
|
||||
$form['#entity_builders'][] = 'contact_storage_test_contact_form_form_builder';
|
||||
}
|
||||
/**
|
||||
* Entity builder for the contact form edit form with third party options.
|
||||
*
|
||||
* @see contact_storage_test_form_contact_form_edit_form_alter()
|
||||
*/
|
||||
function contact_storage_test_contact_form_form_builder($entity_type, ContactFormInterface $contact_form, &$form, FormStateInterface $form_state) {
|
||||
$contact_form->setThirdPartySetting('contact_storage_test', 'send_a_pony', $form_state->getValue('send_a_pony'));
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
id: feedback
|
||||
label: 'Website feedback'
|
||||
recipients: { }
|
||||
reply: ''
|
||||
weight: 0
|
||||
status: true
|
||||
langcode: en
|
|
@ -0,0 +1,8 @@
|
|||
name: 'Contact test module'
|
||||
type: module
|
||||
description: 'Contains test contact form.'
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- contact
|
|
@ -0,0 +1,10 @@
|
|||
name: 'Contact test views'
|
||||
type: module
|
||||
description: 'Provides default views for views contact tests.'
|
||||
package: Testing
|
||||
version: VERSION
|
||||
core: 8.x
|
||||
dependencies:
|
||||
- contact
|
||||
- views
|
||||
- user
|
|
@ -0,0 +1,149 @@
|
|||
langcode: en
|
||||
status: true
|
||||
dependencies:
|
||||
module:
|
||||
- contact
|
||||
- user
|
||||
id: test_contact_link
|
||||
label: test_contact_link
|
||||
module: views
|
||||
description: ''
|
||||
tag: ''
|
||||
base_table: users_field_data
|
||||
base_field: uid
|
||||
core: 8.x
|
||||
display:
|
||||
default:
|
||||
display_plugin: default
|
||||
id: default
|
||||
display_title: Master
|
||||
position: 1
|
||||
display_options:
|
||||
access:
|
||||
type: none
|
||||
cache:
|
||||
type: tag
|
||||
options: { }
|
||||
query:
|
||||
type: views_query
|
||||
options:
|
||||
disable_sql_rewrite: false
|
||||
distinct: false
|
||||
replica: false
|
||||
query_comment: ''
|
||||
query_tags: { }
|
||||
exposed_form:
|
||||
type: basic
|
||||
options:
|
||||
submit_button: Apply
|
||||
reset_button: false
|
||||
reset_button_label: Reset
|
||||
exposed_sorts_label: 'Sort by'
|
||||
expose_sort_order: true
|
||||
sort_asc_label: Asc
|
||||
sort_desc_label: Desc
|
||||
pager:
|
||||
type: full
|
||||
options:
|
||||
items_per_page: 10
|
||||
offset: 0
|
||||
id: 0
|
||||
total_pages: null
|
||||
expose:
|
||||
items_per_page: false
|
||||
items_per_page_label: 'Items per page'
|
||||
items_per_page_options: '5, 10, 20, 40, 60'
|
||||
items_per_page_options_all: false
|
||||
items_per_page_options_all_label: '- All -'
|
||||
offset: false
|
||||
offset_label: Offset
|
||||
tags:
|
||||
previous: '‹ previous'
|
||||
next: 'next ›'
|
||||
first: '« first'
|
||||
last: 'last »'
|
||||
quantity: 9
|
||||
style:
|
||||
type: default
|
||||
row:
|
||||
type: fields
|
||||
fields:
|
||||
name:
|
||||
id: name
|
||||
table: users_field_data
|
||||
field: name
|
||||
label: ''
|
||||
alter:
|
||||
alter_text: false
|
||||
make_link: false
|
||||
absolute: false
|
||||
trim: false
|
||||
word_boundary: false
|
||||
ellipsis: false
|
||||
strip_tags: false
|
||||
html: false
|
||||
hide_empty: false
|
||||
empty_zero: false
|
||||
relationship: none
|
||||
group_type: group
|
||||
admin_label: ''
|
||||
exclude: false
|
||||
element_type: ''
|
||||
element_class: ''
|
||||
element_label_type: ''
|
||||
element_label_class: ''
|
||||
element_label_colon: true
|
||||
element_wrapper_type: ''
|
||||
element_wrapper_class: ''
|
||||
element_default_classes: true
|
||||
empty: ''
|
||||
hide_alter_empty: true
|
||||
plugin_id: field
|
||||
type: user_name
|
||||
entity_type: user
|
||||
entity_field: name
|
||||
contact:
|
||||
id: contact
|
||||
table: users
|
||||
field: contact
|
||||
plugin_id: contact_link
|
||||
exclude: false
|
||||
entity_type: user
|
||||
filters:
|
||||
status:
|
||||
value: true
|
||||
table: users_field_data
|
||||
field: status
|
||||
id: status
|
||||
expose:
|
||||
operator: '0'
|
||||
group: 1
|
||||
plugin_id: boolean
|
||||
entity_type: user
|
||||
entity_field: status
|
||||
sorts: { }
|
||||
title: test_contact_link
|
||||
header: { }
|
||||
footer: { }
|
||||
empty: { }
|
||||
relationships: { }
|
||||
arguments: { }
|
||||
display_extenders: { }
|
||||
cache_metadata:
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
cacheable: false
|
||||
page_1:
|
||||
display_plugin: page
|
||||
id: page_1
|
||||
display_title: Page
|
||||
position: 1
|
||||
display_options:
|
||||
display_extenders: { }
|
||||
path: test-contact-link
|
||||
cache_metadata:
|
||||
contexts:
|
||||
- 'languages:language_content'
|
||||
- 'languages:language_interface'
|
||||
cacheable: false
|
Reference in a new issue