0

I need to get the resolution of the image using getFieldDefinitions(). For normal fields I can get the field definitions with below.

$fieldDefinition = \Drupal::entityManager()->getFieldDefinitions('node', $type);
foreach ($fieldDefinition as $field_name => $field_definition) {
    $settings    = $field_definition->getSettings();
    $resolution  = $settings['min_resolution'];
}

How do I get the field definition of a image field inside of a paragraphs field.

  • 2
    change 'node' to 'paragraph'. – Jaypan Jan 18 at 6:04
0

As it mention in comment just use paragraph instead of node.

$fieldDefinition = \Drupal::entityManager()->getFieldDefinitions('paragraph', 'your_paragraph_type_name');
    foreach ($fieldDefinition as $field_name => $field_definition) {
      if ($field_definition->getType() == 'image'){
        $settings    = $field_definition->getSettings();
        $resolution  = $settings['min_resolution'];
      }
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.