Update to drupal 8.0.0-rc1. For more information, see https://www.drupal.org/node/2582663

This commit is contained in:
Greg Anderson 2015-10-08 11:40:12 -07:00
parent eb34d130a8
commit f32e58e4b1
8476 changed files with 211648 additions and 170042 deletions

View file

@ -176,7 +176,7 @@ class LinkFormatter extends FormatterBase implements ContainerFactoryPluginInter
/**
* {@inheritdoc}
*/
public function viewElements(FieldItemListInterface $items) {
public function viewElements(FieldItemListInterface $items, $langcode) {
$element = array();
$entity = $items->getEntity();
$settings = $this->getSettings();
@ -189,8 +189,9 @@ class LinkFormatter extends FormatterBase implements ContainerFactoryPluginInter
// If the title field value is available, use it for the link text.
if (empty($settings['url_only']) && !empty($item->title)) {
// Unsanitized token replacement here because the entire link title
// gets auto-escaped during link generation.
$link_title = \Drupal::token()->replace($item->title, array($entity->getEntityTypeId() => $entity), array('sanitize' => FALSE, 'clear' => TRUE));
// gets auto-escaped during link generation in
// \Drupal\Core\Utility\LinkGenerator::generate().
$link_title = \Drupal::token()->replace($item->title, [$entity->getEntityTypeId() => $entity], ['clear' => TRUE]);
}
// Trim the link text to the desired length.

View file

@ -42,7 +42,7 @@ class LinkSeparateFormatter extends LinkFormatter {
/**
* {@inheritdoc}
*/
public function viewElements(FieldItemListInterface $items) {
public function viewElements(FieldItemListInterface $items, $langcode) {
$element = array();
$entity = $items->getEntity();
$settings = $this->getSettings();
@ -55,8 +55,9 @@ class LinkSeparateFormatter extends LinkFormatter {
// If the link text field value is available, use it for the text.
if (empty($settings['url_only']) && !empty($item->title)) {
// Unsanitized token replacement here because the entire link title
// gets auto-escaped during link generation.
$link_title = \Drupal::token()->replace($item->title, array($entity->getEntityTypeId() => $entity), array('sanitize' => FALSE, 'clear' => TRUE));
// gets auto-escaped during link generation in
// \Drupal\Core\Utility\LinkGenerator::generate().
$link_title = \Drupal::token()->replace($item->title, [$entity->getEntityTypeId() => $entity], ['clear' => TRUE]);
}
// The link_separate formatter has two titles; the link text (as in the

View file

@ -159,7 +159,9 @@ class LinkWidget extends WidgetBase {
public static function validateTitleElement(&$element, FormStateInterface $form_state, $form) {
if ($element['uri']['#value'] !== '' && $element['title']['#value'] === '') {
$element['title']['#required'] = TRUE;
$form_state->setError($element['title'], t('!name field is required.', array('!name' => $element['title']['#title'])));
// We expect the field name placeholder value to be wrapped in t() here,
// so it won't be escaped again as it's already marked safe.
$form_state->setError($element['title'], t('@name field is required.', array('@name' => $element['title']['#title'])));
}
}

View file

@ -277,14 +277,14 @@ class LinkFieldTest extends WebTestBase {
"{$field_name}[0][uri]" => 'http://www.example.com',
);
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertText(t('!name field is required.', array('!name' => t('Link text'))));
$this->assertText(t('@name field is required.', array('@name' => t('Link text'))));
// Verify that the link text is not required, if the URL is empty.
$edit = array(
"{$field_name}[0][uri]" => '',
);
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertNoText(t('!name field is required.', array('!name' => t('Link text'))));
$this->assertNoText(t('@name field is required.', array('@name' => t('Link text'))));
// Verify that a URL and link text meets requirements.
$this->drupalGet('entity_test/add');
@ -293,7 +293,7 @@ class LinkFieldTest extends WebTestBase {
"{$field_name}[0][title]" => 'Example',
);
$this->drupalPostForm(NULL, $edit, t('Save'));
$this->assertNoText(t('!name field is required.', array('!name' => t('Link text'))));
$this->assertNoText(t('@name field is required.', array('@name' => t('Link text'))));
}
}
}
@ -389,8 +389,8 @@ class LinkFieldTest extends WebTestBase {
// Verify that the link is output according to the formatter settings.
// Not using generatePermutations(), since that leads to 32 cases, which
// would not test actual link field formatter functionality but rather
// _l() and options/attributes. Only 'url_plain' has a dependency on
// 'url_only', so we have a total of ~10 cases.
// the link generator and options/attributes. Only 'url_plain' has a
// dependency on 'url_only', so we have a total of ~10 cases.
$options = array(
'trim_length' => array(NULL, 6),
'rel' => array(NULL, 'nofollow'),