/** * Helper function used only in this view. * It renders a list with sidebar-replacement details */ function list_sidebar_replacement($label, $list) { $import = CustomSidebarsExport::get_import_data(); $theme_sidebars = CustomSidebars::get_sidebars(); foreach ($list as $from_id => $to_id) { $from = $theme_sidebars[$from_id]; $to = array(); if (isset($theme_sidebars[$to_id])) { $to = $theme_sidebars[$to_id]; } else { $to = $import['sidebars'][$to_id]; } ?> <tr> <th scope="row"><?php echo esc_html($label); ?> </th> <td><?php echo esc_html($from['name']); ?> </td> <td><i class="dashicons dashicons-arrow-right-alt hint"></i></td> <td><?php echo esc_html($to['name']); ?> </td> </tr> <?php } }
<?php /** * Contents of the Location popup in the widgets screen. * User can define default locations where the custom sidebar will be used. * * This file is included in widgets.php. */ $sidebars = CustomSidebars::get_sidebars('theme'); /** * Output the input fields to configure replacements for a single sidebar. * * @since 2.0 * @param array $sidebar Details provided by CustomSidebars::get_sidebar(). * @param string $prefix Category specific prefix used for input field ID/Name. * @param string $cat_name Used in label: "Replace sidebar for <cat_name>". * @param string $class Optinal classname added to the wrapper element. */ function _show_replaceable($sidebar, $prefix, $cat_name, $class = '') { $base_id = 'cs-' . $prefix; $inp_id = $base_id . '-' . $sidebar['id']; $inp_name = '___cs___' . $prefix . '___' . $sidebar['id']; $sb_id = $sidebar['id']; $class = empty($class) ? '' : ' ' . $class; ?> <div class="cs-replaceable <?php echo esc_attr($sb_id . $class); ?> "