Is there a way to check if the value of a field within the preprocess is empty? I'm getting an Error: Call to a member function isEmpty()
error during the process
function iom_preprocess_block__twitterfeed(&$variables) {
// Get the twitter_username field from node
$twitterUsername = \Drupal::routeMatch()
->getParameter('node')
->get('field_twitter_username')
->value;
if ($twitterUsername->isEmpty()) {
dump("Empty");
}
else {
dump("Not Empty");
}
}