Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
Remove field depending on display type in Embed entity ckeditor Drupal

I have a specific display for document type entity. We made caption required for other media type but I want it to not be required when I select display as "document link" how can I do ?

For now I have something like this:

function MY_MODULE_form_entity_embed_dialog_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id){
  if (isset($form['attributes']['data-entity-embed-display'] && .....)){
    $form['attributes']['data-caption']['#required'] = FALSE;
  } else {
    $form['attributes']['data-caption']['#required'] = TRUE;
      }

The ... is for adding the fact that document link option must be selected bu I don't know how to do it.

Anyone have an idea, please ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!