{{ attach_library('naomi_2025/node.person.full') }}

{% set view_stories_recent_by_person_has_result = drupal_view_result('content_stories', 'embed_recent_by_person', node.id) %}

{% include "@ui-node/person/full/component/node.person.full.twig" with {
  node_field_label: label,
  node_field_bio: (content.field_bio.0) ? content.field_bio : '',
  node_field_erm_headshot: (content.field_erm_headshot.0) ? content.field_erm_headshot : '',
  node_field_job_title: (content.field_job_title.0) ? content.field_job_title : '',
  node_field_erm_page_image: (content.field_erm_page_image.0) ? content.field_erm_page_image : '',
  node_field_social_links: (content.field_social_links.0) ? content.field_social_links : '',
  node_field_summary: (content.field_summary.0) ? content.field_summary : '',
  node_field_email: (content.field_email.0)
    ? link(
      'Say Hello!',
      'mailto:'~ content.field_email.0['#context']['value'], {
        'aria-label': 'Send email to ' ~ label.0['#context']['value']
      })
    : '',

  node_view_stories_recent_by_person: (view_stories_recent_by_person_has_result)
    ? drupal_view('content_stories', 'embed_recent_by_person', node.id)
    : '',
} %}
