mirror of
https://gitlab.unicamp.br/infimecc_drupal11_modules/site_users.git
synced 2026-05-03 17:00:40 -03:00
Adiciona campo field_user_homepage e ícone de página pessoal no bloco
- Novo campo link field_user_homepage (página pessoal do usuário) - Update hook 10009 para instalações existentes - MicrositeHeaderBlock: variável #homepage via getFieldUri() - Template: link com ícone 'home' como primeiro item nos links acadêmicos - CSS: fill para ícone de casinha no fundo escuro do header Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ function site_users_microsite_theme(): array {
|
||||
'bio' => NULL,
|
||||
'phone' => NULL,
|
||||
'email' => NULL,
|
||||
'homepage' => NULL,
|
||||
'lattes_id' => NULL,
|
||||
'orcid_id' => NULL,
|
||||
'mathscinet_id' => NULL,
|
||||
|
||||
@@ -68,6 +68,7 @@ class MicrositeHeaderBlock extends BlockBase implements ContainerFactoryPluginIn
|
||||
'#bio' => $this->getProcessedValue($user, 'field_user_bio'),
|
||||
'#phone' => $this->getFieldValue($user, 'field_user_phone'),
|
||||
'#email' => $user->getEmail(),
|
||||
'#homepage' => $this->getFieldUri($user, 'field_user_homepage'),
|
||||
'#lattes_id' => $this->getFieldValue($user, 'field_user_id_lattes'),
|
||||
'#orcid_id' => $this->getFieldValue($user, 'field_user_orcid'),
|
||||
'#mathscinet_id' => $this->getFieldValue($user, 'field_user_mathscinetid'),
|
||||
@@ -125,6 +126,16 @@ class MicrositeHeaderBlock extends BlockBase implements ContainerFactoryPluginIn
|
||||
return $media ? $media->label() : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna a URI de um campo link do usuário.
|
||||
*/
|
||||
protected function getFieldUri(UserInterface $user, string $field_name): ?string {
|
||||
if ($user->hasField($field_name) && !$user->get($field_name)->isEmpty()) {
|
||||
return $user->get($field_name)->uri;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retorna o valor de texto de um campo do usuário.
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
* - bio: Biografia (string|null).
|
||||
* - phone: Telefone (string|null).
|
||||
* - email: E-mail (string|null).
|
||||
* - homepage: URL da página pessoal (string|null).
|
||||
* - lattes_id: ID do Currículo Lattes (string|null).
|
||||
* - orcid_id: ORCID iD (string|null).
|
||||
* - mathscinet_id: MathSciNet Author ID (string|null).
|
||||
@@ -57,9 +58,18 @@
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if lattes_id or orcid_id or mathscinet_id %}
|
||||
{% if homepage or lattes_id or orcid_id or mathscinet_id %}
|
||||
<div class="msite-header-block__academic-links">
|
||||
|
||||
{% if homepage %}
|
||||
<a href="{{ homepage }}"
|
||||
class="msite-header-block__academic-link msite-header-block__academic-link--homepage"
|
||||
target="_blank" rel="noopener noreferrer"
|
||||
aria-label="{{ 'Página pessoal'|t }}">
|
||||
{{ site_tools_academic_icon('home') }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if lattes_id %}
|
||||
<a href="https://lattes.cnpq.br/{{ lattes_id }}"
|
||||
class="msite-header-block__academic-link msite-header-block__academic-link--lattes"
|
||||
|
||||
Reference in New Issue
Block a user