public function get_eligible_layouts_for_assignation()
 {
     $ret = array();
     $layouts = DDL_GroupedLayouts::get_all_layouts_as_posts('publish', 'title', 'ids', false, true, false, false, true, 'ASC');
     foreach ($layouts as $layout) {
         $clone = WPDD_Layouts::get_layout_settings($layout, true);
         if (is_object($clone) === false) {
             continue;
         }
         $opts = clone $clone;
         if (is_object($opts) && (property_exists($opts, 'has_child') === false || property_exists($opts, 'has_child') && $opts->has_child === false)) {
             $opts = $this->get_post_content_cell($opts);
             $ret[] = self::_filter_fields_to_keep($opts);
         }
     }
     return $ret;
 }
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new DDL_GroupedLayouts();
     }
     return self::$instance;
 }
예제 #3
0
 private function normalize_children_on_slug_change($layout, $slug, $previous_slug)
 {
     global $wpddlayout;
     $defaults = array('posts_per_page' => -1, 'post_type' => WPDDL_LAYOUTS_POST_TYPE, 'suppress_filters' => true, 'post_status' => 'publish', 'posts_per_page' => -1);
     $query = new WP_Query($defaults);
     $list = $query->posts;
     $children = DDL_GroupedLayouts::get_children($layout, $list, $previous_slug);
     if (!is_array($children) || sizeof($children) === 0) {
         return;
     }
     if (is_array($children) && sizeof($children) > 0) {
         foreach ($children as $child) {
             $current = WPDD_Layouts::get_layout_settings($child, true);
             $current->parent = $slug;
             WPDD_Layouts::save_layout_settings($child, $current);
         }
     }
 }