Update to Drupal 8.0.0 beta 14. For more information, see https://drupal.org/node/2544542
This commit is contained in:
parent
3b2511d96d
commit
81ccda77eb
2155 changed files with 54307 additions and 46870 deletions
|
|
@ -40,10 +40,15 @@ class FieldUI {
|
|||
* @param array $destinations
|
||||
* An array of destinations to redirect to.
|
||||
*
|
||||
* @return \Drupal\Core\Url
|
||||
* @return \Drupal\Core\Url|null
|
||||
* The next destination to redirect to.
|
||||
*/
|
||||
public static function getNextDestination(array $destinations) {
|
||||
// If there are no valid destinations left, return here.
|
||||
if (empty($destinations)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$next_destination = array_shift($destinations);
|
||||
if (is_array($next_destination)) {
|
||||
$next_destination['options']['query']['destinations'] = $destinations;
|
||||
|
|
@ -59,7 +64,7 @@ class FieldUI {
|
|||
}
|
||||
// Redirect to any given path within the same domain.
|
||||
// @todo Revisit this in https://www.drupal.org/node/2418219.
|
||||
$next_destination = Url::fromUserInput('/' . $options['path']);
|
||||
$next_destination = Url::fromUserInput('/' . $options['path'], $options);
|
||||
}
|
||||
return $next_destination;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -567,7 +567,7 @@ abstract class EntityDisplayFormBase extends EntityForm {
|
|||
if ($form_state->get('plugin_settings_update') === $field_name) {
|
||||
// Only store settings actually used by the selected plugin.
|
||||
$default_settings = $this->pluginManager->getDefaultSettings($options['type']);
|
||||
$options['settings'] = array_intersect_key($values['settings_edit_form']['settings'], $default_settings);
|
||||
$options['settings'] = isset($values['settings_edit_form']['settings']) ? array_intersect_key($values['settings_edit_form']['settings'], $default_settings) : [];
|
||||
$options['third_party_settings'] = isset($values['settings_edit_form']['third_party_settings']) ? $values['settings_edit_form']['third_party_settings'] : [];
|
||||
$form_state->set('plugin_settings_update', NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ class EntityDisplayModeAddForm extends EntityDisplayModeFormBase {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(array $form, FormStateInterface $form_state) {
|
||||
parent::validate($form, $form_state);
|
||||
public function validateForm(array &$form, FormStateInterface $form_state) {
|
||||
parent::validateForm($form, $form_state);
|
||||
|
||||
$form_state->setValueForElement($form['id'], $this->targetEntityTypeId . '.' . $form_state->getValue('id'));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,8 +150,8 @@ class FieldConfigEditForm extends EntityForm {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(array $form, FormStateInterface $form_state) {
|
||||
parent::validate($form, $form_state);
|
||||
public function validateForm(array &$form, FormStateInterface $form_state) {
|
||||
parent::validateForm($form, $form_state);
|
||||
|
||||
if (isset($form['default_value'])) {
|
||||
$item = $form['#entity']->get($this->entity->getName());
|
||||
|
|
|
|||
|
|
@ -146,8 +146,8 @@ class FieldStorageConfigEditForm extends EntityForm {
|
|||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function validate(array $form, FormStateInterface $form_state) {
|
||||
parent::validate($form, $form_state);
|
||||
public function validateForm(array &$form, FormStateInterface $form_state) {
|
||||
parent::validateForm($form, $form_state);
|
||||
|
||||
// Validate field cardinality.
|
||||
if ($form_state->getValue('cardinality') === 'number' && !$form_state->getValue('cardinality_number')) {
|
||||
|
|
|
|||
|
|
@ -163,6 +163,11 @@ class ManageDisplayTest extends WebTestBase {
|
|||
$edit = array('fields[field_test][type]' => 'field_no_settings', 'refresh_rows' => 'field_test');
|
||||
$this->drupalPostAjaxForm(NULL, $edit, array('op' => t('Refresh')));
|
||||
$this->assertFieldByName('field_test_settings_edit');
|
||||
|
||||
// Make sure we can save the third party settings when there are no settings available
|
||||
$this->drupalPostAjaxForm(NULL, array(), "field_test_settings_edit");
|
||||
$this->drupalPostAjaxForm(NULL, $edit, "field_test_plugin_settings_update");
|
||||
|
||||
// Uninstall the module providing third party settings and ensure the button
|
||||
// is no longer there.
|
||||
\Drupal::service('module_installer')->uninstall(array('field_third_party_test'));
|
||||
|
|
|
|||
|
|
@ -616,6 +616,20 @@ class ManageFieldsTest extends WebTestBase {
|
|||
$this->assertUrl($url, array(), 'Stayed on the same page.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that external URLs in the 'destinations' query parameter are blocked.
|
||||
*/
|
||||
public function testExternalDestinations() {
|
||||
$options = [
|
||||
'query' => ['destinations' => ['http://example.com']],
|
||||
];
|
||||
$this->drupalPostForm('admin/structure/types/manage/article/fields/node.article.body/storage', [], 'Save field settings', $options);
|
||||
// The external redirect should not fire.
|
||||
$this->assertUrl('admin/structure/types/manage/article/fields/node.article.body/storage', $options);
|
||||
$this->assertResponse(200);
|
||||
$this->assertRaw('Attempt to update field <em class="placeholder">Body</em> failed: <em class="placeholder">The internal path component 'http://example.com' is external. You are not allowed to specify an external URL together with internal:/.</em>.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that deletion removes field storages and fields as expected for a term.
|
||||
*/
|
||||
|
|
|
|||
Reference in a new issue