<?php
|
|
function ami_prerender_core_site_logo(array $block, ?string $content):?string
|
{
|
$open = $close = '';
|
|
if (!is_home() && !is_front_page()) {
|
$open = '<a href="'.get_home_url().'" rel="home">';
|
$close = '</a>';
|
}
|
$cache = (class_exists('JVBase\managers\Cache')) ? JVBase\managers\Cache::for('full-icons') : false;
|
|
if (array_key_exists('attrs', $block) && array_key_exists('className', $block['attrs'])) {
|
$logo = false;
|
if (str_contains($block['attrs']['className'], 'is-text')) {
|
if ($cache) {
|
$martian = $cache->remember('martian', function() {
|
return file_get_contents(AMI_DIR . '/assets/icons/martian infotech logo.svg');
|
});
|
$text = $cache->remember('text', function() {
|
return file_get_contents(AMI_DIR . '/assets/icons/martian infotech.svg');
|
});
|
}else {
|
$martian = file_get_contents(AMI_DIR . '/assets/icons/martian infotech logo.svg');
|
$text = file_get_contents(AMI_DIR . '/assets/icons/martian infotech.svg');
|
}
|
|
$logo = '<div class="logo">'.$martian.$text.'</div>';
|
}else if (array_key_exists('attrs', $block) && str_contains($block['attrs']['className'], 'is-full')) {
|
if ($cache) {
|
$logo = $cache->remember('logo', function() {
|
return file_get_contents(AMI_DIR . '/assets/icons/full-logo.svg');
|
});
|
}else {
|
$logo = file_get_contents(AMI_DIR . '/assets/icons/full-logo.svg');
|
}
|
|
}
|
if ($logo) {
|
return $open.$logo.$close;
|
}
|
}
|
|
return JVB()->blocks()->prerender_core_site_logo($block, $content);
|
}
|