Jake Vanderwerf
2025-12-23 25be5747a6e462a3d09fc6607b3639b79e4d9374
inc/blocks/CustomBlocks.php
@@ -104,6 +104,9 @@
            // Enqueue the feed block script (it will automatically load dependencies)
            $this->localize_feedblock();
        }
      if ($block['blockName'] === 'jvb/forms') {
         wp_enqueue_style('jvb-form');
      }
        return $content;
    }
@@ -138,6 +141,7 @@
      if (str_contains($url[1], 'maps.apple.com')) {
         $icon = 'apple-logo';
      }
      if ($icon !== '') {
         return sprintf(
            '<li%s><a href="%s" title="Find Us On %s">%s Maps</a></li>',
@@ -184,8 +188,9 @@
    protected function render_core_group(array $block):string
    {
        $tag = (array_key_exists('tagName', $block['attrs'])) ? $block['attrs']['tagName'] : 'div';
        $classes = ($tag === 'main') ?
            $this->getClassesAndStyles($block['attrs']) :
            '' :
            $this->getClassesAndStyles($block['attrs'], ['group']);
        return '<'.$tag.$classes.'>'.$this->innerBlocks($block).'</'.$tag.'>';
    }
@@ -282,10 +287,10 @@
                wp_get_attachment_caption($ID) .
            '</figcaption>' :
            '<figcaption>' . $title . '</figcaption>';
      $size = array_key_exists('sizeSlug', $block['attrs']) ? $block['attrs']['sizeSlug'] : 'large';
        return '<figure'.
               $this->getClassesAndStyles($block['attrs']).'>'.
               $this->imageLink(true, $ID) .
               $this->imageLink(true, $ID, 'tiny', $size) .
               $caption.'</figure>';
    }
@@ -293,7 +298,9 @@
    {
        $ID = $this->imageID('', $block);
        $imgLink = ($ID) ? $this->imageLink(true, $ID) : '';
      $size = array_key_exists('mediaSizeSlug', $block['attrs']) ? $block['attrs']['mediaSizeSlug'] : 'large';
        $imgLink = ($ID) ? $this->imageLink(true, $ID, 'tiny', $size) : '';
        $inner = $this->innerBlocks($block);
@@ -513,10 +520,11 @@
            home_url($block['attrs']['url']) :
            $block['attrs']['url'];
        $current = (home_url($wp->request.'/') == $url);
      $temp = $block['attrs'];
      unset($temp['url']);
        $classes = ($current) ?
            $this->getClassesAndStyles($block['attrs'], ['current']):
            $this->getClassesAndStyles($block['attrs']);
            $this->getClassesAndStyles($temp, ['current']):
            $this->getClassesAndStyles($temp);
        $aria = '';
        if ($current) {
            $aria = ' aria-current="page"';
@@ -535,9 +543,11 @@
            $block['attrs']['url'];
        $current = (home_url($wp->request) == $url);
      $temp = $block['attrs'];
      unset($temp['url']);
        $classes = ($current) ?
            $this->getClassesAndStyles($block['attrs'], ['has-submenu', 'current']):
            $this->getClassesAndStyles($block['attrs'], ['has-submenu']);
            $this->getClassesAndStyles($temp, ['has-submenu', 'current']):
            $this->getClassesAndStyles($temp, ['has-submenu']);
        $aria = '';
        if ($current) {
@@ -816,15 +826,18 @@
                $title = ($checked == '') ? 'Toggle Dark Mode' : 'Toggle Light Mode';
            $showThemeSwitch = (bool)apply_filters('jvb_show_theme_switch', true);
                $themeSwitch = ($showThemeSwitch) ? '<label title="'.$title.'" id="theme-switch" class="toggle-switch" for="theme-switcher">
                    <input class="theme-switch row" id="theme-switcher" type="checkbox"'.$checked.' data-setting="theme" data-theme role="switch" name="dark-mode"><span class="slider">'.
                    <input class="theme-switch row" id="theme-switcher" name="theme-switcher" type="checkbox"'.$checked.' data-setting="theme" data-theme role="switch" name="dark-mode" aria-label="Toggle dark mode"><span class="slider">'.
               jvbIcon('sun-dim', ['title'=> 'Light Mode']).
               jvbIcon('moon', ['title'=>'Dark Mode']).
               '</span></label>' : '';
                $breadcrumbs = jvbBuildBreadcrumbs();
            $afterHeader = apply_filters('jvbBelowHeader', $afterHeader);
            if ($afterHeader !== '') {
               $afterHeader = '<aside class="sub-header">'.$afterHeader.'</aside>';
            }
            $footerText = '<div class="scroll-progress"><div class="bar"></div>
</div>';
            } elseif ($isFooterTemplate) {
            $beforeHeader = apply_filters('jvbBeforeFooter', '');
            if ($beforeHeader !== '') {
@@ -1196,9 +1209,9 @@
            $type = 'row';
                if (array_key_exists('type', $value)) {
               $type = 'col';
                    if ($value['type'] === 'constrained') {
                        $classes[] = 'container col';
                    }
//                    if ($value['type'] === 'constrained') {
//                        $classes[] = 'container col';
//                    }
                }
            if (array_key_exists('orientation', $value)) {
               $type = 'col';
@@ -1501,6 +1514,7 @@
            // Background URL (for cover, media blocks)
            case 'url':
            jvbDump($value);
                if (!empty($value) && str_starts_with($value, 'http')) {
                    $styles[] = 'background-image: url('.$value.')';
                }