src/StartPlatz/Bundle/MentorsBundle/Resources/views/Public/_expert-card.html.twig line 1

Open in your IDE?
  1. {# Expert in Residence Card - Simplified Version #}
  2. {% set expertData = expert.expertMetadata %}
  3. {# Set language for all fields #}
  4. {% if language is defined %}
  5.     {% set lang = language %}
  6. {% else %}
  7.     {% set lang = app.request.locale|default('de') %}
  8. {% endif %}
  9. {% if lang not in ['de', 'en'] %}{% set lang = 'de' %}{% endif %}
  10. <div class="expert-card premium">
  11.     {# Edit Icon for Admins/Masters #}
  12.     {% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MASTER') %}
  13.         <a href="{{ path('admin_mentors_edit', {'category': 'experts', 'id': expert.id}) }}"
  14.            class="edit-corner-link"
  15.            title="Bearbeiten"
  16.            aria-label="Expert bearbeiten">
  17.             <i class="fas fa-edit"></i>
  18.         </a>
  19.     {% endif %}
  20.     {# SP-Connect Rocket Icon (replaces LinkedIn icon for conversion strategy) #}
  21.     <a href="{{ path('connect_mentor_show', {'id': expert.id}) }}"
  22.        target="_blank"
  23.        rel="noopener noreferrer"
  24.        class="sp-connect-corner-link"
  25.        aria-label="{{ lang == 'de' ? 'SP-Connect Profil von' : 'SP-Connect Profile of' }} {{ expert.firstName }} {{ expert.lastName }}"
  26.        title="{{ lang == 'de' ? 'SP-Connect Profil ansehen' : 'View SP-Connect Profile' }}">
  27.         <i class="fas fa-rocket sp-connect-corner-icon"></i>
  28.     </a>
  29.     <div class="expert-header">
  30.         <div class="expert-image-container">
  31.             <img src="{{ expert.profileImage|default('https://res.cloudinary.com/startplatz/image/upload/v1637360496/Wordpress/Sprechstunden/Sprechstunden_Platzhalter.jpg') }}"
  32.                  alt="{{ expert.firstName }} {{ expert.lastName }}"
  33.                  class="expert-image">
  34.             <div class="expert-badge">Expert in Residence</div>
  35.         </div>
  36.     </div>
  37.     <div class="expert-content">
  38.         <h2 class="expert-name">{{ expert.firstName }} {{ expert.lastName }}</h2>
  39.         {# Main Focus - NEW SIMPLIFIED FIELD with fallback to old title #}
  40.         {% set mainFocusField = 'mainFocus_' ~ lang %}
  41.         {% set mainFocus = attribute(expertData, mainFocusField) is defined ? attribute(expertData, mainFocusField) : null %}
  42.         {% if not mainFocus %}
  43.             {# Fallback to old title fields #}
  44.             {% set titleField = 'title_' ~ lang %}
  45.             {% set mainFocus = attribute(expertData, titleField) is defined ? attribute(expertData, titleField) : expertData.title|default('') %}
  46.         {% endif %}
  47.         {% if mainFocus %}
  48.             <p class="expert-title text-primary font-weight-bold mb-2">{{ mainFocus }}</p>
  49.         {% endif %}
  50.         {# Expert Bio - NEW SIMPLIFIED FIELD with fallback #}
  51.         {% set bioField = 'expertBio_' ~ lang %}
  52.         {% set expertBio = attribute(expertData, bioField) is defined ? attribute(expertData, bioField) : null %}
  53.         {% if not expertBio %}
  54.             {# Fallback to description #}
  55.             {% set expertBio = expert.description|default('') %}
  56.         {% endif %}
  57.         <div class="expert-bio text-muted small mb-3">
  58.             {% if expertBio %}
  59.                 {{ expertBio|striptags|slice(0, 160) }}{% if expertBio|striptags|length > 160 %}...{% endif %}
  60.             {% else %}
  61.                 <em class="text-muted">{{ lang == 'de' ? 'Profil in Bearbeitung' : 'Profile under construction' }}</em>
  62.             {% endif %}
  63.         </div>
  64.         {# Ask me about - NEW SIMPLIFIED FIELD with fallback #}
  65.         {% set askMeField = 'askMeAbout_' ~ lang %}
  66.         {% set askMeAbout = attribute(expertData, askMeField) is defined ? attribute(expertData, askMeField) : null %}
  67.         {% if not askMeAbout and expertData.expertFeatures is defined and expertData.expertFeatures.askMeAbout is defined %}
  68.             {# Fallback to old expertFeatures #}
  69.             {% set askMeAbout = expertData.expertFeatures.askMeAbout[lang]|default('') %}
  70.         {% endif %}
  71.         {% if not askMeAbout %}
  72.             {# Fallback to first 3 expertise areas #}
  73.             {% set expertiseField = 'expertiseAreas_' ~ lang %}
  74.             {% if attribute(expertData, expertiseField) is defined %}
  75.                 {% set areas = attribute(expertData, expertiseField) %}
  76.                 {% if areas is iterable %}
  77.                     {% set askMeAbout = areas|slice(0,3)|join(', ') %}
  78.                 {% endif %}
  79.             {% elseif expertData.expertiseAreas is defined %}
  80.                 {% set areas = expertData.expertiseAreas is iterable ? expertData.expertiseAreas : expertData.expertiseAreas|split(',') %}
  81.                 {% set askMeAbout = areas|slice(0,3)|join(', ') %}
  82.             {% endif %}
  83.         {% endif %}
  84.         {% if askMeAbout %}
  85.             <div class="expert-feature mb-2">
  86.                 <strong class="text-muted small">{{ lang == 'de' ? 'Frag mich zu:' : 'Ask me about:' }}</strong><br>
  87.                 <span class="text-dark">{{ askMeAbout }}</span>
  88.             </div>
  89.         {% endif %}
  90.         {# Connect Modes with Icons #}
  91.         {% set connectModes = expertData.connectModes ?? ['community'] %}
  92.         {% set modeIcons = {
  93.             'residency': '☕',
  94.             'meetup': '🎯',
  95.             'ama-session': '💬',
  96.             'accelerator-events': '🎪',
  97.             'community': '💻'
  98.         } %}
  99.         {% set modeLabels = {
  100.             'residency': {'de': 'Kaffeemaschine / Coworking', 'en': 'Coffee Machine / Coworking'},
  101.             'meetup': {'de': 'Meetups & Events', 'en': 'Meetups & Events'},
  102.             'ama-session': {'de': 'AMA-Sessions', 'en': 'AMA Sessions'},
  103.             'accelerator-events': {'de': 'Accelerator-Events', 'en': 'Accelerator Events'},
  104.             'community': {'de': 'Digitale Community', 'en': 'Digital Community'}
  105.         } %}
  106.         {% if connectModes is not empty %}
  107.             <div class="expert-feature mb-3">
  108.                 <strong class="text-muted small">{{ lang == 'de' ? 'Triff mich bei:' : 'Meet me at:' }}</strong>
  109.                 <div style="margin-top: 6px;">
  110.                     {% for mode in connectModes %}
  111.                         {% if modeLabels[mode] is defined %}
  112.                             <div class="d-flex align-items-center mb-1" style="gap: 8px;">
  113.                                 <span style="font-size: 16px;">{{ modeIcons[mode] }}</span>
  114.                                 <span class="text-dark" style="font-size: 13px;">{{ modeLabels[mode][lang] }}</span>
  115.                             </div>
  116.                         {% endif %}
  117.                     {% endfor %}
  118.                 </div>
  119.             </div>
  120.         {% endif %}
  121.     </div>
  122. </div>