πŸ‡΅πŸ‡­Philippines @erwindaez

Account created on 28 January 2020, almost 5 years ago
#

Merge Requests

Recent comments

πŸ‡΅πŸ‡­Philippines erwindaez

erwindaez β†’ created an issue.

πŸ‡΅πŸ‡­Philippines erwindaez

Hi @dieterholvoet

Steps on how to reproduce the issue

1. Add constraint on your custom form field, example

 $form['my_custom_field'] = [
   '#type' => 'managed_file',
          '#upload_validators' => [
            'CustomFormat' => ['format' => $format],
          ],
];

2. Create CustomFormatConstraint and CustomFormatConstraintValidator classes
3. Add validate to CustomFormatConstraintValidator
4. Test if the message from your constraint will show up

Currently what is happening if we have invalid value to the field
https://www.drupal.org/files/issues/2024-09-26/Screenshot%202024-09-26%2... β†’

πŸ‡΅πŸ‡­Philippines erwindaez

Hi @dieterholvoet

For this one I think the issue is on toastify\Element\ToastifyStatusMessages, renderMessages interrupts all messages event the messages that Contstraint validator shows

 public static function renderMessages($type = NULL): array {
    if (!\Drupal::currentUser()->hasPermission('show toastify messages')) {
      return parent::renderMessages($type);
    }

    $render = [];
    if (isset($type)) {
      $messages = [
        $type => \Drupal::messenger()->deleteByType($type),
      ];
    }
    else {
      $messages = \Drupal::messenger()->deleteAll();
    }

    if ($messages) {
      // Pass the messages to Toastify.
      $render['#attached']['drupalSettings']['toastify']['messages'] = $messages;
    }

    return $render;
  }

A sample screenshot is the current behavior on what toastify does
https://www.drupal.org/files/issues/2024-09-26/Screenshot%202024-09-26%2... β†’

VS on what we expect
https://www.drupal.org/files/issues/2024-09-26/Screenshot%202024-09-26%2... β†’

πŸ‡΅πŸ‡­Philippines erwindaez

erwindaez β†’ created an issue.

πŸ‡΅πŸ‡­Philippines erwindaez

erwindaez β†’ created an issue.

πŸ‡΅πŸ‡­Philippines erwindaez

erwindaez β†’ changed the visibility of the branch 3464585-update-cta-image to active.

πŸ‡΅πŸ‡­Philippines erwindaez

erwindaez β†’ changed the visibility of the branch 3464585-CTA-image-field to hidden.

πŸ‡΅πŸ‡­Philippines erwindaez

erwindaez β†’ made their first commit to this issue’s fork.

πŸ‡΅πŸ‡­Philippines erwindaez

erwindaez β†’ made their first commit to this issue’s fork.

πŸ‡΅πŸ‡­Philippines erwindaez

Hi Keshav,

Confirmed the patch on #5 complies with #4
Here is the code on line 22:

  /**
   * {@inheritdoc}
   */
  public function getFile() {
    return base_path() . 'libraries/eqneditor/plugin.js';
  }
πŸ‡΅πŸ‡­Philippines erwindaez

Hi @alok_singh,
Confirmed updated, please see the screenshot

πŸ‡΅πŸ‡­Philippines erwindaez

erwindaez β†’ made their first commit to this issue’s fork.

Production build 0.71.5 2024