added static/dynamic divs to actor
This commit is contained in:
parent
a5132bbcfc
commit
2e071af1b7
@ -20,17 +20,5 @@ use Drupal\Core\Render\Element;
|
|||||||
* - attributes: HTML attributes for the containing element.
|
* - attributes: HTML attributes for the containing element.
|
||||||
*/
|
*/
|
||||||
function template_preprocess_oc_actor(array &$variables) {
|
function template_preprocess_oc_actor(array &$variables) {
|
||||||
// Make the id available to the template and also separate the fields
|
_template_preprocess_entity($variables);
|
||||||
// into two sections to be displayed in two columns.
|
|
||||||
$variables['id'] = $variables['elements']['#oc_actor']->get('id')[0]->get('value')->getValue();
|
|
||||||
$variables['contact_details'] = array();
|
|
||||||
$variables['fields_other_than_contact_details'] = array();
|
|
||||||
foreach (Element::children($variables['elements']) as $key) {
|
|
||||||
$variables['content'][$key] = $variables['elements'][$key];
|
|
||||||
if (in_array($key, ['email', 'phone', 'phone2', 'postal_address', 'post_code'])) {
|
|
||||||
$variables['contact_details'][$key] = $variables['elements'][$key];
|
|
||||||
} else {
|
|
||||||
$variables['fields_other_than_contact_details'][$key] = $variables['elements'][$key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
#}
|
#}
|
||||||
<div{{ attributes.addClass('oc_actor') }}>
|
<div{{ attributes.addClass('oc_actor') }}>
|
||||||
{% if content %}
|
{% if normal_fields %}
|
||||||
{{- content -}}
|
<div id='static_data'>{{- normal_fields -}}</div>
|
||||||
|
{% endif %}
|
||||||
|
{% if extra_fields %}
|
||||||
|
<div id='dynamic_data'>{{- extra_fields -}}</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user