PluginProbe
Elementor Website Builder – more than just a page builder / 4.2.4
Elementor Website Builder – more than just a page builder v4.2.4
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 4.1.0-beta1 All 453 releases
← All changes | modules/global-classes/global-classes-relations.php +10 -8 4.1.0-dev34.2.4 View file →
@@ -343,15 +343,9 @@
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 - $document = $documents->get( $post_id );
348 -
349 - if ( ! $document ) {
350 - return null;
351 - }
352 -
353 - return $document ?? null;
347 + return $this->get_document_or_null( $documents->get( $post_id ) );
354 348 }
355 349
356 350 $document = $documents->get_doc_or_auto_save( $post_id, get_current_user_id() );
357 351
@@ -358,7 +352,15 @@
358 352 if ( ! $document ) {
359 353 $document = $documents->get( $post_id );
360 354 }
361 355
362 - return $document ?? null;
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;
363 365 }
364 366 }