foldershare-8.x-1.2/src/Entity/FolderShareTraits/GetSetDescriptionTrait.php

src/Entity/FolderShareTraits/GetSetDescriptionTrait.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
 
namespace Drupal\foldershare\Entity\FolderShareTraits;
 
/**
 * Get/set FolderShare entity description field.
 *
 * This trait includes get and set methods for FolderShare entity
 * description field.
 *
 * <B>Internal trait</B>
 * This trait is internal to the FolderShare module and used to define
 * features of the FolderShare entity class. It is a mechanism to group
 * functionality to improve code management.
 *
 * @ingroup foldershare
 */
trait GetSetDescriptionTrait {
 
  /*---------------------------------------------------------------------
   *
   * Description field.
   *
   *---------------------------------------------------------------------*/
 
  /**
   * {@inheritdoc}
   */
  public function getDescription() {
    $text = $this->description->getValue();
    if ($text === NULL) {
      return '';
    }
 
    return $text;
  }
 
  /**
   * {@inheritdoc}
   */
  public function setDescription(string $text) {
    if (empty($text) === TRUE) {
      $this->description->setValue(NULL);
    }
    else {
      $this->description->setValue($text);
    }
  }
 
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc