🇮🇳India @SHIJU JOHN

Account created on 14 July 2010, over 14 years ago
#

Recent comments

🇮🇳India SHIJU JOHN

@joachim, @ashetkar Thank you so much for the patch and 3.0.0-alpha3 version.

🇮🇳India SHIJU JOHN

@joyachim, Is it possible to support D10 in 3.x version? We have more than 200 websites using this hook in D9 and can you please guide me the best way to migrate this to D10?

function computed_field_field_asset_type_compute($entity_type_manager, $entity, $fields, $delta) {
  $width = $entity->field_dimension->width;
  $height = $entity->field_dimension->height;
  $is_transparent = $entity->field_is_transparent->value;
  if (strtolower($is_transparent) == 'yes') {
    $asset_type = 'transparent';
  }
  elseif ($width > 1600 && $height > 1200) {
    $asset_type = 'high_dimension';
  }
  else {
    $asset_type = 'regular';
  }
  return $asset_type;
}
🇮🇳India SHIJU JOHN

Hi @itmaybejj,
Thank you for your response on this. I am planning to give a bypass/overide option of this in my settings. I am thinking to add a form alter '#validate' in wysiwyg text area field like below.

$form['my_element'] = [  '#type' => 'textfield',  '#title' => t('My Element'),  '#validate' => ['my_custom_validation_function'],
];

Also I want to write a custom validation like below

function my_custom_validation_function($element, &$form_state) {
  $any_ed11y_errors = \Drupal::service('ed11y-validator.js')->getJsSettings()['ed11y_errors'];

  // Validate the form element based on the JavaScript variable.
  if ($any_ed11y_errors) {
    form_set_error($element, t('Please fix the accessibility errors before publishing this changes.'));
  }
}

Finally in Javascript file I want to check the ed11y errors and pass to Drupal

Drupal.behaviors.myBehavior = {
  attach: function(context, settings) {
    const ed11y = new Ed11y(ed11yOptions); 
    settings.ed11y_errors = ed11y.errorCount;
  }
};
🇮🇳India SHIJU JOHN

Hi John,
I have a similar requirement to prevent publishing a content if any accessibility issues in the page. Is there any method which I can call for this validation from this module? Please suggest

Best Regards,
Shiju John

Production build 0.71.5 2024