Update to Drupal 8.1.1. For more information, see https://www.drupal.org/node/2718713

This commit is contained in:
Pantheon Automation 2016-05-04 14:35:41 -07:00 committed by Greg Anderson
parent c0a0d5a94c
commit 9eae24d844
669 changed files with 3873 additions and 1553 deletions

View file

@ -17,7 +17,7 @@ use Drupal\Core\Render\Element;
* $form['actions'] = array('#type' => 'actions');
* $form['actions']['submit'] = array(
* '#type' => 'submit',
* '#value' => t('Save'),
* '#value' => $this->t('Save'),
* );
* @endcode
*

View file

@ -72,10 +72,9 @@ class Button extends FormElement {
*
* @param array $element
* An associative array containing the properties of the element.
* Properties used: #attributes, #button_type, #name, #value.
*
* The #button_type property accepts any value, though core themes have CSS that
* styles the following button_types appropriately: 'primary', 'danger'.
* Properties used: #attributes, #button_type, #name, #value. The
* #button_type property accepts any value, though core themes have CSS that
* styles the following button_types appropriately: 'primary', 'danger'.
*
* @return array
* The $element with prepared variables ready for input.html.twig.

View file

@ -15,7 +15,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['copy'] = array(
* '#type' => 'checkbox',
* '#title' => t('Send me a copy'),
* '#title' => $this->t('Send me a copy'),
* );
* @endcode
*

View file

@ -17,8 +17,8 @@ use Drupal\Core\Form\FormStateInterface;
* @code
* $form['high_school']['tests_taken'] = array(
* '#type' => 'checkboxes',
* '#options' => array('SAT' => t('SAT'), 'ACT' => t('ACT'))),
* '#title' => t('What standardized tests did you take?'),
* '#options' => array('SAT' => $this->t('SAT'), 'ACT' => $this->t('ACT'))),
* '#title' => $this->t('What standardized tests did you take?'),
* ...
* );
* @endcode

View file

@ -16,7 +16,7 @@ use Drupal\Component\Utility\Color as ColorUtility;
* @code
* $form['color'] = array(
* '#type' => 'color',
* '#title' => 'Color',
* '#title' => $this->t('Color'),
* '#default_value' => '#ffffff',
* );
* @endcode

View file

@ -15,7 +15,7 @@ use Drupal\Core\Form\FormStateInterface;
* @code
* $form['needs_accommodation'] = array(
* '#type' => 'checkbox',
* '#title' => 'Need Special Accommodations?',
* '#title' => $this->t('Need Special Accommodations?'),
* );
*
* $form['accommodation'] = array(
@ -32,7 +32,7 @@ use Drupal\Core\Form\FormStateInterface;
*
* $form['accommodation']['diet'] = array(
* '#type' => 'textfield',
* '#title' => t('Dietary Restrictions'),
* '#title' => $this->t('Dietary Restrictions'),
* );
* @endcode
*

View file

@ -15,7 +15,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['expiration'] = array(
* '#type' => 'date',
* '#title' => t('Content expiration'),
* '#title' => $this->t('Content expiration'),
* '#default_value' => array('year' => 2020, 'month' => 2, 'day' => 15,)
* );
* @endcode
@ -76,11 +76,9 @@ class Date extends FormElement {
* @param array $element
* An associative array containing the properties of the element.
* Properties used: #title, #value, #options, #description, #required,
* #attributes, #id, #name, #type, #min, #max, #step, #value, #size.
*
* Note: The input "name" attribute needs to be sanitized before output, which
* is currently done by initializing Drupal\Core\Template\Attribute with
* all the attributes.
* #attributes, #id, #name, #type, #min, #max, #step, #value, #size. The
* #name property will be sanitized before output. This is currently done by
* initializing Drupal\Core\Template\Attribute with all the attributes.
*
* @return array
* The $element with prepared variables ready for #theme 'input__date'.

View file

@ -20,12 +20,12 @@ use Drupal\Core\Render\Element;
* @code
* $form['author'] = array(
* '#type' => 'details',
* '#title' => 'Author',
* '#title' => $this->t('Author'),
* );
*
* $form['author']['name'] = array(
* '#type' => 'textfield',
* '#title' => t('Name'),
* '#title' => $this->t('Name'),
* );
* @endcode
*

View file

@ -15,7 +15,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['email'] = array(
* '#type' => 'email',
* '#title' => t('Email'),
* '#title' => $this->t('Email'),
* );
* @end
*

View file

@ -9,12 +9,12 @@ namespace Drupal\Core\Render\Element;
* @code
* $form['author'] = array(
* '#type' => 'fieldset',
* '#title' => 'Author',
* '#title' => $this->t('Author'),
* );
*
* $form['author']['name'] = array(
* '#type' => 'textfield',
* '#title' => t('Name'),
* '#title' => $this->t('Name'),
* );
* @endcode
*

View file

@ -21,7 +21,7 @@ use Drupal\Component\Utility\Number as NumberUtility;
* @code
* $form['quantity'] = array(
* '#type' => 'number',
* '#title' => t('Quantity'),
* '#title' => $this->t('Quantity'),
* );
* @endcode
*

View file

@ -12,7 +12,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['pass'] = array(
* '#type' => 'password',
* '#title => t('Password'),
* '#title' => $this->t('Password'),
* '#size' => 25,
* );
* @endcode

View file

@ -14,7 +14,7 @@ use Drupal\Core\Form\FormStateInterface;
* @code
* $form['pass'] = array(
* '#type' => 'password_confirm',
* '#title' => t('Password'),
* '#title' => $this->t('Password'),
* '#size' => 25,
* );
* @endcode
@ -65,7 +65,7 @@ class PasswordConfirm extends FormElement {
* Expand a password_confirm field into two text boxes.
*/
public static function processPasswordConfirm(&$element, FormStateInterface $form_state, &$complete_form) {
$element['pass1'] = array(
$element['pass1'] = array(
'#type' => 'password',
'#title' => t('Password'),
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass1'],
@ -73,7 +73,7 @@ class PasswordConfirm extends FormElement {
'#attributes' => array('class' => array('password-field', 'js-password-field')),
'#error_no_message' => TRUE,
);
$element['pass2'] = array(
$element['pass2'] = array(
'#type' => 'password',
'#title' => t('Confirm password'),
'#value' => empty($element['#value']) ? NULL : $element['#value']['pass2'],

View file

@ -43,11 +43,9 @@ class Radio extends FormElement {
* @param array $element
* An associative array containing the properties of the element.
* Properties used: #required, #return_value, #value, #attributes, #title,
* #description.
*
* Note: The input "name" attribute needs to be sanitized before output, which
* is currently done by initializing Drupal\Core\Template\Attribute with
* all the attributes.
* #description. The #name property will be sanitized before output. This is
* currently done by initializing Drupal\Core\Template\Attribute with all
* the attributes.
*
* @return array
* The $element with prepared variables ready for input.html.twig.

View file

@ -16,9 +16,9 @@ use Drupal\Component\Utility\Html as HtmlUtility;
* @code
* $form['settings']['active'] = array(
* '#type' => 'radios',
* '#title' => t('Poll status'),
* '#title' => $this->t('Poll status'),
* '#default_value' => 1,
* '#options' => array(0 => t('Closed'), 1 => t('Active')),
* '#options' => array(0 => $this->t('Closed'), 1 => $this->t('Active')),
* );
* @endcode
*

View file

@ -19,7 +19,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['quantity'] = array(
* '#type' => 'number',
* '#title' => t('Quantity'),
* '#title' => $this->t('Quantity'),
* );
* @endcode
*

View file

@ -11,7 +11,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['search'] = array(
* '#type' => 'search',
* '#title' => t('Search'),
* '#title' => $this->t('Search'),
* );
* @endcode
*

View file

@ -21,14 +21,14 @@ use Drupal\Core\Render\Element;
* @code
* $form['example_select'] = [
* '#type' => 'select',
* '#title' => t('Select element'),
* '#title' => $this->t('Select element'),
* '#options' => [
* '1' => t('One'),
* '1' => $this->t('One'),
* '2' => [
* '2.1' => t('Two point one'),
* '2.2' => t('Two point two'),
* '2.1' => $this->t('Two point one'),
* '2.2' => $this->t('Two point two'),
* ],
* '3' => t('Three'),
* '3' => $this->t('Three'),
* ],
* ];
* @endcode

View file

@ -29,20 +29,20 @@ use Drupal\Component\Utility\Html as HtmlUtility;
* @code
* $form['contacts'] = array(
* '#type' => 'table',
* '#caption' => 'Sample Table',
* '#header' => array('Name', 'Phone'),
* '#caption' => $this->t('Sample Table'),
* '#header' => array($this->t('Name'), $this->t('Phone')),
* );
*
* for ($i=1; $i<=4; $i++) {
* $form['contacts'][$i]['name'] = array(
* '#type' => 'textfield',
* '#title' => t('Name'),
* '#title' => $this->t('Name'),
* '#title_display' => 'invisible',
* );
*
* $form['contacts'][$i]['phone'] = array(
* '#type' => 'tel',
* '#title' => t('Phone'),
* '#title' => $this->t('Phone'),
* '#title_display' => 'invisible',
* );
* }
@ -279,7 +279,7 @@ class Table extends FormElement {
* @code
* $form['table'] = array(
* '#type' => 'table',
* '#header' => array(t('Title'), array('data' => t('Operations'), 'colspan' => '1')),
* '#header' => array($this->t('Title'), array('data' => $this->t('Operations'), 'colspan' => '1')),
* // Optionally, to add tableDrag support:
* '#tabledrag' => array(
* array(
@ -301,7 +301,7 @@ class Table extends FormElement {
* $form['table'][$row]['#attributes']['class'][] = 'draggable';
* $form['table'][$row]['weight'] = array(
* '#type' => 'textfield',
* '#title' => t('Weight for @title', array('@title' => $thing['title'])),
* '#title' => $this->t('Weight for @title', array('@title' => $thing['title'])),
* '#title_display' => 'invisible',
* '#size' => 4,
* '#default_value' => $thing['weight'],
@ -312,7 +312,7 @@ class Table extends FormElement {
* // attribute in #header above.
* $form['table'][$row]['edit'] = array(
* '#type' => 'link',
* '#title' => t('Edit'),
* '#title' => $this->t('Edit'),
* '#url' => Url::fromRoute('entity.test_entity.edit_form', ['test_entity' => $row]),
* );
* }

View file

@ -26,8 +26,8 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
* Usage example:
* @code
* $header = [
* 'first_name' => t('First Name'),
* 'last_name' => t('Last Name'),
* 'first_name' => $this->t('First Name'),
* 'last_name' => $this->t('Last Name'),
* ];
*
* $options = [
@ -40,7 +40,7 @@ use Drupal\Core\StringTranslation\TranslatableMarkup;
* '#type' => 'tableselect',
* '#header' => $header,
* '#options' => $options,
* '#empty' => t('No users found'),
* '#empty' => $this->t('No users found'),
* );
* @endcode
*
@ -118,28 +118,28 @@ class Tableselect extends Table {
* @code
* $options = array(
* array(
* 'title' => 'How to Learn Drupal',
* 'content_type' => 'Article',
* 'title' => $this->t('How to Learn Drupal'),
* 'content_type' => $this->t('Article'),
* 'status' => 'published',
* '#attributes' => array('class' => array('article-row')),
* ),
* array(
* 'title' => 'Privacy Policy',
* 'content_type' => 'Page',
* 'title' => $this->t('Privacy Policy'),
* 'content_type' => $this->t('Page'),
* 'status' => 'published',
* '#attributes' => array('class' => array('page-row')),
* ),
* );
* $header = array(
* 'title' => t('Title'),
* 'content_type' => t('Content type'),
* 'status' => t('Status'),
* 'title' => $this->t('Title'),
* 'content_type' => $this->t('Content type'),
* 'status' => $this->t('Status'),
* );
* $form['table'] = array(
* '#type' => 'tableselect',
* '#header' => $header,
* '#options' => $options,
* '#empty' => t('No content available.'),
* '#empty' => $this->t('No content available.'),
* );
* @endcode
*

View file

@ -14,7 +14,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['phone'] = array(
* '#type' => 'tel',
* '#title' => t('Phone'),
* '#title' => $this->t('Phone'),
* );
* @endcode
*

View file

@ -17,7 +17,7 @@ use Drupal\Core\Form\FormStateInterface;
* @code
* $form['text'] = array(
* '#type' => 'textarea',
* '#title' => t('Text'),
* '#title' => $this->t('Text'),
* );
* @endcode
*

View file

@ -20,7 +20,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['title'] = array(
* '#type' => 'textfield',
* '#title' => t('Subject'),
* '#title' => $this->t('Subject'),
* '#default_value' => $node->title,
* '#size' => 60,
* '#maxlength' => 128,

View file

@ -16,7 +16,7 @@ use Drupal\Core\Render\Element;
* @code
* $form['homepage'] = array(
* '#type' => 'url',
* '#title' => t('Home Page'),
* '#title' => $this->t('Home Page'),
* '#size' => 30,
* ...
* );

View file

@ -24,24 +24,24 @@ use Drupal\Core\Render\Element;
*
* $form['author'] = array(
* '#type' => 'details',
* '#title' => 'Author',
* '#title' => $this->t('Author'),
* '#group' => 'information',
* );
*
* $form['author']['name'] = array(
* '#type' => 'textfield',
* '#title' => t('Name'),
* '#title' => $this->t('Name'),
* );
*
* $form['publication'] = array(
* '#type' => 'details',
* '#title' => t('Publication'),
* '#title' => $this->t('Publication'),
* '#group' => 'information',
* );
*
* $form['publication']['publisher'] = array(
* '#type' => 'textfield',
* '#title' => t('Publisher'),
* '#title' => $this->t('Publisher'),
* );
* @endcode
*

View file

@ -18,7 +18,7 @@ use Drupal\Core\Form\FormStateInterface;
* @code
* $form['weight'] = array(
* '#type' => 'weight',
* '#title' => t('Weight'),
* '#title' => $this->t('Weight'),
* '#default_value' => $edit['weight'],
* '#delta' => 10,
* );

View file

@ -92,6 +92,11 @@ class PlaceholderingRenderCache extends RenderCache {
* {@inheritdoc}
*/
public function get(array $elements) {
// @todo remove this check when https://www.drupal.org/node/2367555 lands.
if (!$this->requestStack->getCurrentRequest()->isMethodSafe()) {
return FALSE;
}
// When rendering placeholders, special case auto-placeholdered elements:
// avoid retrieving them from cache again, or rendering them again.
if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === FALSE) {
@ -121,6 +126,11 @@ class PlaceholderingRenderCache extends RenderCache {
public function set(array &$elements, array $pre_bubbling_elements) {
$result = parent::set($elements, $pre_bubbling_elements);
// @todo remove this check when https://www.drupal.org/node/2367555 lands.
if (!$this->requestStack->getCurrentRequest()->isMethodSafe()) {
return FALSE;
}
if ($this->placeholderGenerator->canCreatePlaceholder($pre_bubbling_elements) && $this->placeholderGenerator->shouldAutomaticallyPlaceholder($elements)) {
// Overwrite $elements with a placeholder. The Renderer (which called this
// method) will update the context with the bubbleable metadata of the

View file

@ -338,7 +338,9 @@ class Renderer implements RendererInterface {
// If instructed to create a placeholder, and a #lazy_builder callback is
// present (without such a callback, it would be impossible to replace the
// placeholder), replace the current element with a placeholder.
if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === TRUE) {
// @todo remove the isMethodSafe() check when
// https://www.drupal.org/node/2367555 lands.
if (isset($elements['#create_placeholder']) && $elements['#create_placeholder'] === TRUE && $this->requestStack->getCurrentRequest()->isMethodSafe()) {
if (!isset($elements['#lazy_builder'])) {
throw new \LogicException('When #create_placeholder is set, a #lazy_builder callback must be present as well.');
}