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,6 @@
|
|||
name: 'Page Cache Form Test'
|
||||
type: module
|
||||
description: 'Support module for the Page Cache module tests.'
|
||||
core: 8.x
|
||||
package: Testing
|
||||
version: VERSION
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
*
|
||||
* Install hooks for page_cache_form_test.
|
||||
*/
|
||||
|
||||
function page_cache_form_test_install() {
|
||||
// Set an explicit module weight, to ensure that the form alter hook is
|
||||
// always called after page_cache_form_alter().
|
||||
module_set_weight('page_cache_form_test', 10);
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Provides functionality for testing form caching.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function page_cache_form_test_form_page_cache_form_test_alter(&$form, FormStateInterface $form_state, $form_id) {
|
||||
if (isset($form_state->getBuildInfo()['immutable']) && $form_state->getBuildInfo()['immutable']) {
|
||||
$form['#suffix'] = 'Immutable: TRUE';
|
||||
}
|
||||
else {
|
||||
$form['#suffix'] = 'Immutable: FALSE';
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
page_cache_form_test.test_immutability:
|
||||
path: '/page_cache_form_test_immutability'
|
||||
defaults:
|
||||
_form: '\Drupal\page_cache_form_test\Form\TestForm'
|
||||
requirements:
|
||||
_access: 'TRUE'
|
||||
35
core/modules/page_cache/tests/modules/src/Form/TestForm.php
Normal file
35
core/modules/page_cache/tests/modules/src/Form/TestForm.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Contains \Drupal\page_cache_form_test\Form\TestForm.
|
||||
*/
|
||||
|
||||
namespace Drupal\page_cache_form_test\Form;
|
||||
|
||||
use Drupal\Core\Form\FormBase;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
class TestForm extends FormBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getFormId() {
|
||||
return 'page_cache_form_test';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function buildForm(array $form, FormStateInterface $form_state) {
|
||||
$form['#prefix'] = '<p>Llamas are awesome, but kittens are pretty cool too!</p>';
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) { }
|
||||
|
||||
}
|
||||
Reference in a new issue