Ejemplo n.º 1
0
function acfmod_close_sections($content = '')
{
    global $acfmod_sections;
    # close any sections still open
    if (count($acfmod_sections)) {
        foreach ($acfmod_sections as $key => $section) {
            $content .= acfmod_close_section();
        }
    }
    return $content;
}
Ejemplo n.º 2
0
function acfmod_module_loop($context = NULL)
{
    global $acfmod_sections, $acfmod_current_section, $acfmod_module_count;
    if (!is_array($acfmod_sections)) {
        $acfmod_sections = array();
    }
    if (!$acfmod_module_count) {
        $acfmod_module_count = 0;
    }
    $content = '';
    $style = '';
    $module = apply_filters('acfmod/modules/' . get_row_layout(), '');
    $styles = get_sub_field('module_styles');
    if (get_row_layout() == 'section') {
        if (get_sub_field('close_previous_section')) {
            $content .= acfmod_close_section();
        }
        $content .= acfmod_open_section();
    }
    if ($module) {
        $acfmod_module_count++;
        $col_width = '';
        $section_open = false;
        if (isset($acfmod_sections[$acfmod_current_section])) {
            $acfmod_sections[$acfmod_current_section]->current_col++;
            $col_width = $acfmod_sections[$acfmod_current_section]->get_col_width();
            $section_open = $acfmod_sections[$acfmod_current_section]->is_open();
        }
        if ($col_width || $styles) {
            $content .= '<style type="text/css">';
            $content .= '.module.module-' . $acfmod_module_count . ',.section.two-column>.module.module-' . $acfmod_module_count . ',.section.three-column>.module.module-' . $acfmod_module_count . ',.section.four-column>.module.module-' . $acfmod_module_count . ' {';
            if ($col_width) {
                $content .= 'width: ' . $col_width . '%;';
            }
            if ($styles) {
                $content .= $styles;
            }
            $content .= '}';
            $content .= '</style>';
        }
        $content .= '<div class="module module-' . get_row_layout() . ' module-' . $acfmod_module_count . '">';
        if (!$section_open) {
            if (function_exists('genesis_structural_wrap')) {
                $content .= genesis_structural_wrap('modular-content', 'open', false);
            }
        }
        $content .= '<div class="module-inner">';
        $content .= $module;
        $content .= '</div><!-- .module-inner -->';
        if (!$section_open) {
            if (function_exists('genesis_structural_wrap')) {
                $content .= genesis_structural_wrap('modular-content', 'close', false);
            }
        }
        $content .= '</div><!-- .module -->';
    }
    if (get_row_layout() == 'section_closer') {
        $content .= acfmod_close_section();
    }
    return $content;
}