Commit fb820401 authored by Julian Pustkuchen's avatar Julian Pustkuchen
Browse files

Issue #3312852 by Anybody, Grevil: Improve form labels and descriptions

parent ee687a04
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -24,16 +24,16 @@ class RiddleForm extends EntityForm {
      '#title' => $this->t('Question'),
      '#maxlength' => 255,
      '#default_value' => $this->entity->getQuestion() ?? '',
      '#description' => $this->t('The riddle question to answer.'),
      '#description' => $this->t('The question to answer by one of the allowed answers below.'),
      '#required' => TRUE,
    ];

    $form['solution'] = [
      '#type' => 'textfield',
      '#title' => $this->t('Solution'),
      '#title' => $this->t('Allowed answer(s)'),
      '#maxlength' => 255,
      '#default_value' => $this->entity->getSolution() ?? '',
      '#description' => $this->t('The riddle solution.<br><b>Note</b>: You can define multiple solutions, if you seperate them with a ","!'),
      '#description' => $this->t('The allowed answer(s) to this question. The answers are case-insensitive. Multiple allowed answers can be separated by a comma (",").'),
      '#required' => TRUE,
    ];

@@ -63,8 +63,8 @@ class RiddleForm extends EntityForm {
    $result = parent::save($form, $form_state);
    $message_args = ['%question' => $this->entity->getQuestion()];
    $message = $result == SAVED_NEW
      ? $this->t('Created new riddle %question.', $message_args)
      : $this->t('Updated riddle %question.', $message_args);
      ? $this->t('Created new CAPTCHA Riddler question: "%question".', $message_args)
      : $this->t('Updated CAPTCHA Riddler question: "%question".', $message_args);
    $this->messenger()->addStatus($message);
    $form_state->setRedirectUrl($this->entity->toUrl('collection'));
    return $result;
+2 −2
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ class RiddlerFunctionalTest extends BrowserTestBase {
    $page->pressButton('edit-submit');
    // See if the riddle got created:
    $session->statusCodeEquals(200);
    $session->pageTextContains('Created new riddle Test Question?.');
    $session->pageTextContains('Created new CAPTCHA Riddler question: "Test Question?".');
    // See if newly created riddle appears in table:
    $session->elementTextEquals('css', 'body > div > div > main > div > div > table > tbody > tr:nth-child(2) > td:nth-child(1)', 'Test Question?');
    $session->elementTextEquals('css', 'body > div > div > main > div > div > table > tbody > tr:nth-child(2) > td:nth-child(2)', 'Test Solution!');
@@ -165,7 +165,7 @@ class RiddlerFunctionalTest extends BrowserTestBase {
    $page->pressButton('edit-submit');
    // See if the riddle got changed:
    $session->statusCodeEquals(200);
    $session->pageTextContains('Updated riddle Test Question?.');
    $session->pageTextContains('Updated CAPTCHA Riddler question: "Test Question?".');
    // See if the changed values appear in the table:
    $session->elementTextEquals('css', 'body > div > div > main > div > div > table > tbody > tr:nth-child(2) > td:nth-child(1)', 'Test Question?');
    $session->elementTextEquals('css', 'body > div > div > main > div > div > table > tbody > tr:nth-child(2) > td:nth-child(2)', 'Test Solution!');