/** * Ensure that a portal object is custom. Modifies the * incoming portal object. */ public static function force_clone(MyPortal $portal) { $identifier = $portal->wp_id; // do not force a clone if the wp_id is 0 (manipulating the default layout) // or if the user ALREADY has a cloned layout if (0 === $identifier || !$portal->is_default_layout()) { return; } $portal->cloneLayout(); }