示例#1
0
 public function get_wrappers_select_options_for_mirroring()
 {
     $wrappers = HeadwayWrappers::get_all_wrappers();
     $options = array('' => '– Do Not Mirror –');
     //If there are no blocks, then just return the Do Not Mirror option.
     if (empty($wrappers) || !is_array($wrappers)) {
         return $options;
     }
     foreach ($wrappers as $wrapper_id => $wrapper_settings) {
         /* If we can't get a name for the layout, then things probably aren't looking good.  Just skip this wrapper. */
         if (!($layout_name = HeadwayLayout::get_name($wrapper_settings['layout']))) {
             continue;
         }
         /* Check for mirroring here */
         if (HeadwayWrappers::get_wrapper_mirror($wrapper_settings)) {
             continue;
         }
         $current_layout_suffix = $this->wrapper['layout'] == $wrapper_settings['layout'] ? ' (Warning: Same Layout)' : null;
         $wrapper_alias = headway_get('alias', $wrapper_settings) ? ' – ' . headway_get('alias', $wrapper_settings) : null;
         //Get alias if it exists, otherwise use the default name
         $options[$wrapper_id] = 'Wrapper #' . HeadwayWrappers::format_wrapper_id($wrapper_id) . $wrapper_alias . ' – ' . $layout_name . $current_layout_suffix;
     }
     //Remove the current wrapper from the list
     unset($options[$this->wrapper['id']]);
     return $options;
 }
示例#2
0
 public static function get_wrapper($wrapper_id, $layout_id = null)
 {
     $all_wrappers = HeadwayWrappers::get_all_wrappers();
     $wrapper = headway_get('wrapper-' . HeadwayWrappers::format_wrapper_id($wrapper_id), $all_wrappers);
     /* No wrapper found.  Use default if layout ID is provided */
     if (!$wrapper && $layout_id) {
         $wrapper = self::get_default_wrapper_settings($layout_id, $wrapper_id);
     }
     /* Add in wrapper ID */
     $wrapper['id'] = 'wrapper-' . HeadwayWrappers::format_wrapper_id($wrapper_id);
     return $wrapper;
 }