Example #1
0
 public static function format_wrappers_array($wrappers, $layout_id, $include_design_editor_instance = false)
 {
     /* Loop through and run headway_fix_data_type() for each layout */
     foreach ($wrappers as $wrapper_id => $wrapper_settings) {
         /* Use wrapper defaults, then merge in the actual wrapper settings and run fix_data_type on the wrapper settings that way booleans, etc are set correctly */
         $wrappers[$wrapper_id] = array_merge(self::$default_wrappers['wrapper-default'], array_map('headway_fix_data_type', $wrapper_settings));
         /* Add wrapper ID and layout ID to the wrapper settings */
         $wrappers[$wrapper_id]['id'] = $wrapper_id;
         $wrappers[$wrapper_id]['layout'] = $layout_id;
         /* Include Design Editor instance if set to do so */
         if ($include_design_editor_instance) {
             $wrappers[$wrapper_id]['styling'] = HeadwayElementsData::get_special_element_properties(array('element' => 'wrapper', 'se_type' => 'instance', 'se_meta' => $wrapper_id . '-layout-' . $layout_id, 'element_group' => 'structure'));
         }
     }
     return $wrappers;
 }
 public static function method_get_element_inputs()
 {
     $element = headway_post('element');
     $special_element_type = headway_post('specialElementType', false);
     $special_element_meta = headway_post('specialElementMeta', false);
     $group = $element['group'];
     $unsaved_values = headway_post('unsavedValues', false);
     /* Make sure that the library is loaded */
     Headway::load('visual-editor/panels/design/property-inputs');
     /* Get values */
     if (!$special_element_type && !$special_element_meta) {
         $property_values = HeadwayElementsData::get_element_properties($element['id'], $group);
         $property_values_excluding_defaults = HeadwayElementsData::get_element_properties($element['id'], $group, true);
     } else {
         $property_values_args = array('element' => $element['id'], 'se_type' => $special_element_type, 'se_meta' => $special_element_meta, 'element_group' => $group);
         $property_values = HeadwayElementsData::get_special_element_properties($property_values_args);
         $property_values_excluding_defaults = HeadwayElementsData::get_special_element_properties(array_merge($property_values_args, array('exclude_default_data' => true)));
     }
     /* Merge in the unsaved values */
     $property_values = is_array($unsaved_values) ? array_merge($property_values, $unsaved_values) : $property_values;
     $property_values_excluding_defaults = is_array($unsaved_values) ? array_merge($property_values_excluding_defaults, $unsaved_values) : $property_values_excluding_defaults;
     /* Display the appropriate inputs and values depending on the element */
     HeadwayPropertyInputs::display($element, $special_element_type, $special_element_meta, $property_values, $property_values_excluding_defaults);
 }