Beispiel #1
0
function theme_set_widget_style($id, $style)
{
    global $theme_widgets_style;
    if (!in_array($style, array_keys($theme_widgets_style))) {
        $style = 'default';
    }
    theme_set_widget_meta_option($id, 'theme_widget_styles', $style);
}
 private function insert_sidebars($sidebars_info)
 {
     foreach ($sidebars_info as $sidebar) {
         foreach ($sidebar['blocks'] as $block) {
             $content = $block['content'];
             if (isset($content)) {
                 $content = $this->replace_image_sources($content);
                 $content = $this->replace_posts_sources($content);
             }
             $widget_id = theme_add_widget($sidebar['name'], $block['type'], $block['name']);
             if ('menuWidget' == $block['type'] && null != $this->vmenu_id) {
                 $args = array('source' => 'Custom Menu', 'nav_menu' => $this->vmenu_id);
                 theme_update_widget($widget_id, $block['title'], $content, $args);
             } else {
                 theme_update_widget($widget_id, $block['title'], $content);
             }
             if (!empty($block['pageHead'])) {
                 $theme_widget_styling = str_replace('<style', '<style scoped="scoped"', $block['pageHead']);
                 $theme_widget_styling = $this->replace_image_sources($theme_widget_styling);
                 theme_set_widget_meta_option($widget_id, 'theme_widget_styling', $theme_widget_styling);
             }
             $this->sample_data['widgets'][] = $widget_id;
         }
     }
 }