PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.0-dev3
Elementor Website Builder – more than just a page builder v4.1.0-dev3
4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 All 454 releases
← All changes | modules/global-classes/global-classes-relations.php +8 -10 4.2.14.1.0-dev3 View file →
@@ -343,9 +343,15 @@
343 343 private function get_document_for_post( int $post_id ): ?Document {
344 344 $documents = Plugin::$instance->documents;
345 345
346 346 if ( ! $this->is_preview() ) {
347 - return $this->get_document_or_null( $documents->get( $post_id ) );
347 + $document = $documents->get( $post_id );
348 +
349 + if ( ! $document ) {
350 + return null;
351 + }
352 +
353 + return $document ?? null;
348 354 }
349 355
350 356 $document = $documents->get_doc_or_auto_save( $post_id, get_current_user_id() );
351 357
@@ -352,15 +358,7 @@
352 358 if ( ! $document ) {
353 359 $document = $documents->get( $post_id );
354 360 }
355 361
356 - return $this->get_document_or_null( $document );
357 - }
358 -
359 - private function get_document_or_null( $document ): ?Document {
360 - if ( empty( $document ) ) {
361 - return null;
362 - }
363 -
364 - return $document;
362 + return $document ?? null;
365 363 }
366 364 }