Skip to main content
Fixing the error.
Source Link
itsdarrylnorris
  • 4.8k
  • 2
  • 40
  • 61

Assuming this information is from the user profile.

You could do the following

blend.theme

$node = $variables['node'];
function blend_preprocess_node(&$variables){
    $node = $variables['node'];
    $variables['firstname'] = $node->getOwner()->field_first_name->value;
    $variables['lastname'] = $node->getOwner()->field_last_name->value;
}

From there you can use {{ firstname }} and {{lastname}} anywhere in your template.

Assuming this information is from the user profile.

You could do the following

blend.theme

$node = $variables['node'];
function blend_preprocess_node(&$variables){
    $variables['firstname'] = $node->getOwner()->field_first_name->value;
    $variables['lastname'] = $node->getOwner()->field_last_name->value;
}

From there you can use {{ firstname }} and {{lastname}} anywhere in your template.

Assuming this information is from the user profile.

You could do the following

blend.theme

function blend_preprocess_node(&$variables){
    $node = $variables['node'];
    $variables['firstname'] = $node->getOwner()->field_first_name->value;
    $variables['lastname'] = $node->getOwner()->field_last_name->value;
}

From there you can use {{ firstname }} and {{lastname}} anywhere in your template.

Source Link
itsdarrylnorris
  • 4.8k
  • 2
  • 40
  • 61

Assuming this information is from the user profile.

You could do the following

blend.theme

$node = $variables['node'];
function blend_preprocess_node(&$variables){
    $variables['firstname'] = $node->getOwner()->field_first_name->value;
    $variables['lastname'] = $node->getOwner()->field_last_name->value;
}

From there you can use {{ firstname }} and {{lastname}} anywhere in your template.