Skip to content

Commit

Permalink
chore: remove left over code which should have been removed
Browse files Browse the repository at this point in the history
  • Loading branch information
jeabakker committed Oct 15, 2021
1 parent 1757e07 commit 3d3ba11
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 21 deletions.
1 change: 0 additions & 1 deletion views/default/profile/fields/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
echo elgg_view('profile/fields/field', [
'entity' => $entity,
'field' => $field,
'is_attribute' => $category_guid === -1,
'microformats' => elgg_extract('microformats', $vars, []),
]);
}
33 changes: 13 additions & 20 deletions views/default/profile/fields/field.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*
* @uses $vars['entity'] the user
* @uses $vars['field'] profile field
* @uses $vars['is_attribute'] fetch data from atribute (default: false)
* @uses $vars['microformats'] Mapping of fieldnames to microformats
*/

Expand All @@ -26,24 +25,20 @@

$shortname = $field->metadata_name;
$valtype = $field->metadata_type;
if ((bool) elgg_extract('is_attribute', $vars, false)) {
// system data is not annotations
$value = $user->$shortname;
} else {
$annotations = $entity->getAnnotations([
'annotation_names' => "profile:{$shortname}",
'limit' => false,
]);
$values = array_map(function (ElggAnnotation $a) {
return $a->value;
}, $annotations);

if (!$values) {
return;
}
// emulate metadata API
$value = (count($values) === 1) ? $values[0] : $values;
$annotations = $entity->getAnnotations([
'annotation_names' => "profile:{$shortname}",
'limit' => false,
]);
$values = array_map(function (ElggAnnotation $a) {
return $a->value;
}, $annotations);

if (!$values) {
return;
}
// emulate metadata API
$value = (count($values) === 1) ? $values[0] : $values;

if (elgg_is_empty($value)) {
return;
Expand All @@ -62,12 +57,10 @@
}
}

$class = elgg_extract($shortname, $microformats, '');

echo elgg_view('object/elements/field', [
'label' => $field->getDisplayName(),
'value' => elgg_format_element('span', [
'class' => $class,
'class' => elgg_extract($shortname, $microformats),
], elgg_view("output/{$valtype}", [
'value' => $value,
])),
Expand Down

0 comments on commit 3d3ba11

Please sign in to comment.