Skip to content
Snippets Groups Projects
Commit 81087eb4 authored by Alex Pott's avatar Alex Pott
Browse files

Revert "Issue #2527606 by dawehner, plach, mpdonadio, xjm, Wim Leers, Fabianx:...

Revert "Issue #2527606 by dawehner, plach, mpdonadio, xjm, Wim Leers, Fabianx: Uncaught PHP Exception LogicException when editing Views"

This reverts commit c78d806e.
parent 5a528e59
No related branches found
No related tags found
No related merge requests found
......@@ -875,16 +875,10 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$this->documentSelfTokens($options[t('Fields')]);
// Default text.
$output = [];
$output[] = [
'#markup' => '<p>' . $this->t('You must add some additional fields to this display before using this field. These fields may be marked as <em>Exclude from display</em> if you prefer. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.') . '</p>',
];
$output = '<p>' . $this->t('You must add some additional fields to this display before using this field. These fields may be marked as <em>Exclude from display</em> if you prefer. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.') . '</p>';
// We have some options, so make a list.
if (!empty($options)) {
$output[] = [
'#markup' => '<p>' . $this->t("The following replacement tokens are available for this field. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.") . '</p>',
];
$output = '<p>' . $this->t("The following replacement tokens are available for this field. Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields.") . '</p>';
foreach (array_keys($options) as $type) {
if (!empty($options[$type])) {
$items = array();
......@@ -896,7 +890,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
'#items' => $items,
'#list_type' => $type,
);
$output[] = $item_list;
$output .= $this->getRenderer()->render($item_list);
}
}
}
......@@ -907,7 +901,7 @@ public function buildOptionsForm(&$form, FormStateInterface $form_state) {
$form['alter']['help'] = array(
'#type' => 'details',
'#title' => $this->t('Replacement patterns'),
'#value' => $output,
'#value' => SafeMarkup::set($output),
'#states' => array(
'visible' => array(
array(
......
......@@ -12,8 +12,6 @@
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormState;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\Core\Render\RenderContext;
use Drupal\views_ui\ViewUI;
use Drupal\views\ViewEntityInterface;
use Drupal\views\Ajax;
......@@ -207,21 +205,8 @@ protected function ajaxFormWrapper($form_class, FormStateInterface &$form_state)
}
$form_state->disableCache();
// Builds the form in a render context in order to ensure that cacheable
// metadata is bubbled up.
$render_context = new RenderContext();
$callable = function () use ($form_class, &$form_state) {
return \Drupal::formBuilder()->buildForm($form_class, $form_state);
};
$form = $renderer->executeInRenderContext($render_context, $callable);
if (!$render_context->isEmpty()) {
BubbleableMetadata::createFromRenderArray($form)
->merge($render_context->pop())
->applyTo($form);
}
$form = \Drupal::formBuilder()->buildForm($form_class, $form_state);
$output = $renderer->renderRoot($form);
drupal_process_attached($form);
// These forms have the title built in, so set the title here:
......
......@@ -74,23 +74,4 @@ public function randomView(array $view = array()) {
return $default;
}
/**
* {@inheritdoc}
*/
protected function drupalGet($path, array $options = array(), array $headers = array()) {
$url = $this->buildUrl($path, $options);
// Ensure that each nojs page is accessible via ajax as well.
if (strpos($url, 'nojs') !== FALSE) {
$url = str_replace('nojs', 'ajax', $url);
$result = $this->drupalGet($url, $options, $headers);
$this->assertResponse(200);
$this->assertHeader('Content-Type', 'application/json');
$this->assertTrue(json_decode($result), 'Ensure that the AJAX request returned valid content.');
}
return parent::drupalGet($path, $options, $headers);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment