Skip to content
Snippets Groups Projects

Issue #3419311 by bluegeek9: User Test Form: unable to see kint results

Merged Steven Ayers requested to merge issue/ldap-3419311:3419311-user-test-form into 8.x-4.x
1 file
+ 13
15
Compare changes
  • Side-by-side
  • Inline
@@ -7,7 +7,6 @@ namespace Drupal\ldap_user\Form;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Drupal\externalauth\Authmap;
use Drupal\ldap_servers\LdapUserAttributesInterface;
use Drupal\ldap_servers\LdapUserManager;
@@ -157,6 +156,17 @@ final class LdapUserTestForm extends FormBase implements LdapUserAttributesInter
'#weight' => 100,
];
if ($form_state->has('ldap_user_test_data')) {
$test_data = $form_state->get('ldap_user_test_data');
$form['test_data'] = [
'#type' => 'textarea',
'#title' => $this->t('Test Results'),
'#rows' => 20,
'#default_value' => \json_encode($test_data, JSON_PRETTY_PRINT),
'#weight' => 200,
];
}
return $form;
}
@@ -228,20 +238,8 @@ final class LdapUserTestForm extends FormBase implements LdapUserAttributesInter
}
}
if (\function_exists('kint')) {
// @phpcs:ignore
kint($results);
}
else {
$this->messenger()
->addWarning($this->t('This form will not display results unless the devel and kint module is enabled.'));
}
$params = [
'action' => $selected_action,
'username' => $username,
];
$form_state->setRedirectUrl(Url::fromRoute('ldap_user.test_form', $params));
$form_state->set('ldap_user_test_data', $results);
$form_state->setRebuild();
}
/**
Loading