mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/site_users.git
synced 2026-03-09 09:57:41 -03:00
Implementa o field type 'social_link' com seletor de rede e URL de
perfil, composto por:
- SocialLinkItem: field type com colunas 'network' (varchar 64) e
'url' (varchar 2048), cardinalidade ilimitada
- SocialLinkWidget: widget com select de rede e input de URL
- SocialLinkFormatter: formatter que renderiza links com classe CSS
por rede (social-link--{network}), target _blank e rel noopener
- config/optional: field.storage e field.field para user
- config/translations/pt-br: tradução do label e description
- hook_install e update_10002: configura form/view displays
- UserInfoBlock: expõe social_links via getSocialLinks()
- Template: adiciona seção de redes sociais e remove referências
obsoletas a category e dept_code
- translations/site_users.pt-br.po: strings do novo field type
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
64 lines
1.8 KiB
Twig
64 lines
1.8 KiB
Twig
{#
|
|
/**
|
|
* @file
|
|
* Template for the user information block.
|
|
*
|
|
* Available variables:
|
|
* - user_info: Array with user information:
|
|
* - uid: User ID
|
|
* - username: Display name
|
|
* - name: Full name
|
|
* - phone: Phone number
|
|
* - bio: Biography
|
|
* - social_links: Array of social links, each with 'network' and 'url' keys
|
|
* - photo_url: Default photo URL
|
|
* - photo_alt: Photo alternative text
|
|
* - user: User entity.
|
|
*/
|
|
#}
|
|
<div class="site-user-info-block">
|
|
<div class="site-user-info-block__photo">
|
|
{% if user_info.photo_url %}
|
|
<img src="{{ user_info.photo_url }}" alt="{{ user_info.photo_alt }}" class="site-user-info-block__image" />
|
|
{% else %}
|
|
<div class="site-user-info-block__no-photo">
|
|
<span class="site-user-info-block__initials">
|
|
{{ user_info.name ? user_info.name|first|upper : user_info.username|first|upper }}
|
|
</span>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
|
|
<div class="site-user-info-block__details">
|
|
<h2 class="site-user-info-block__name">
|
|
{{ user_info.name ?: user_info.username }}
|
|
</h2>
|
|
|
|
{% if user_info.phone %}
|
|
<div class="site-user-info-block__phone">
|
|
<span class="site-user-info-block__label">{{ 'Phone:'|t }}</span>
|
|
<a href="tel:{{ user_info.phone }}">{{ user_info.phone }}</a>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if user_info.bio %}
|
|
<div class="site-user-info-block__bio">
|
|
{{ user_info.bio }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if user_info.social_links %}
|
|
<div class="site-user-info-block__social-links">
|
|
{% for link in user_info.social_links %}
|
|
<a href="{{ link.url }}"
|
|
class="social-link social-link--{{ link.network }}"
|
|
target="_blank"
|
|
rel="noopener noreferrer">
|
|
{{ link.network }}
|
|
</a>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|