<?php
<?php

?>
?>

Hey all,

Looking to wrap a set of divs with an a href referring to the resource URL. Doing so currently hoses our entire site. Thoughts?

function _get_single_page_content_offers() {
$content_offer = $collections = array();
$node = \Drupal::routeMatch()->getParameter('node');
$langcode = \Drupal::languageManager()->getCurrentLanguage(LanguageInterface::TYPE_CONTENT)->getId();
if($node->field_content_offers) {
$field_content_offers = $node->field_content_offers->getValue();
foreach($field_content_offers as $field) {
$collections[] = $field['target_id'];
}
$storage = \Drupal::entityManager()->getStorage('node');
$resources = $storage->loadMultiple($collections);
$i = 1;
$c = count($resources);
foreach($resources as $resource_base) {
if ($resource_base->hasTranslation($langcode)) {
$resource = $resource_base->getTranslation($langcode);
} else {
$resource = $resource_base;
}

$title = $resource->title->value;
// $type = ($resource->field_resource_type->entity) ? $resource->field_resource_type->entity->name->value : '';
$type = '';
if ($resource->field_resource_type->entity->hasTranslation($langcode))
{
$type = $resource->field_resource_type->entity->getTranslation($langcode)->name->value;
} else {
$type = $resource->field_resource_type->entity->name->value;
}

$content = ($resource->field_resource_content->value) ? $resource->field_resource_content->value : '';
$image = ($resource->field_resource_image->entity) ? $resource->field_resource_image->entity->url() : '';
$url = ($resource->field_resource_link->uri) ? $resource->field_resource_link->uri : $resource->url();
$buttons_url = $url;

//Looking to Wrap With Resource $url Link

$content_offer[$i] = '

$content_offer[$i] .= '

$content_offer[$i] .= '

$content_offer[$i] .= '

$content_offer[$i] .= '

$content_offer[$i] .= '

$i++;

//End Link
}
}
return $content_offer;
}