PluginProbe
Depicter — Popup & Slider Builder / 1.5.2
Depicter — Popup & Slider Builder v1.5.2
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Document / Models / Traits / UnPublishedNoticeTrait.php

UnPublishedNoticeTrait.php in Depicter — Popup & Slider Builder 1.5.2, at app/src/Document/Models/Traits/UnPublishedNoticeTrait.php

55 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Depicter\Document\Models\Traits;
3
4 trait UnPublishedNoticeTrait {
5 use HasDocumentIdTrait;
6 use EntityPropertiesTrait;
7
8 /**
9 * @var int|null
10 */
11 protected $showUnpublishedNotice = false;
12
13 /**
14 * Gets document ID
15 *
16 * @return int|null
17 */
18 public function showUnpublishedNotice() {
19 return $this->showUnpublishedNotice;
20 }
21
22 /**
23 * Enables or disables unpublished notice of document
24 *
25 * @param int $showUnpublishedNotice
26 *
27 * @return mixed
28 */
29 public function setUnpublishedNotice( $showUnpublishedNotice = false ) {
30 $this->showUnpublishedNotice = $showUnpublishedNotice;
31 return $this;
32 }
33
34 /**
35 * Render unpublished changes notice
36 *
37 * @return string
38 */
39 public function getUnpublishedChangesNotice() {
40 if( ! $this->showUnpublishedNotice() || ! $this->getDocumentID() ) {
41 return '';
42 }
43 $markup = '';
44
45 if ( $this->getEntityProperty('status') === 'draft' ) {
46 $markup = \Depicter::view('admin/notices/slider-draft-notice')->with( 'view_args', [
47 'isPublishedBefore' => \Depicter::documentRepository()->isPublishedBefore( $this->getDocumentID() ),
48 'editUrl' => \Depicter::editor()->getEditUrl( $this->getDocumentID() )
49 ])->toString();
50 }
51
52 return $markup;
53 }
54 }
55