| Total Complexity | 11 |
| Total Lines | 73 |
| Duplicated Lines | 0 % |
| Changes | 7 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class ClientSidePasswordField extends ReadonlyField |
||
| 9 | { |
||
| 10 | protected $template = 'Sunnysideup/PasswordSaver/Form/ClientSidePasswordField'; |
||
| 11 | protected $ManagerLink; |
||
| 12 | |||
| 13 | public function __construct($name, $title = null, $value = null, string $link = null) |
||
| 14 | { |
||
| 15 | parent::__construct($name, $title, $value); |
||
| 16 | if ($link) { |
||
| 17 | $this->ManagerLink = $link; |
||
| 18 | } |
||
| 19 | } |
||
| 20 | |||
| 21 | public function ManagerLink() |
||
| 22 | { |
||
| 23 | return $this->ManagerLink; |
||
| 24 | } |
||
| 25 | |||
| 26 | public function setManagerLink(string $link) |
||
| 27 | { |
||
| 28 | $this->ManagerLink = $link; |
||
| 29 | } |
||
| 30 | |||
| 31 | public function Type() |
||
| 32 | { |
||
| 33 | return 'text password client-side-passsword'; |
||
| 34 | } |
||
| 35 | |||
| 36 | public function Title() |
||
| 37 | { |
||
| 38 | return 'Password Key'; |
||
| 39 | } |
||
| 40 | |||
| 41 | public function getDescription() |
||
| 49 | ] |
||
| 50 | ) |
||
| 51 | ); |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @return mixed|string |
||
| 56 | */ |
||
| 57 | public function Value() |
||
| 58 | { |
||
| 59 | // Get raw value |
||
| 60 | $value = $this->dataValue(); |
||
| 61 | $fontSize = '2em'; |
||
| 62 | if (!$value) { |
||
| 63 | $value = 'Code not set yet - please save this record first'; |
||
| 64 | $fontSize = '1em'; |
||
| 65 | } |
||
| 66 | return DBHTMLText::create_field( |
||
| 67 | 'HTMLText', |
||
| 68 | '<pre style="margin-bottom:0; font-size: ' . $fontSize . ';">' . $value . '</pre>' |
||
| 69 | ); |
||
| 70 | |||
| 71 | } |
||
| 72 | |||
| 73 | public function isReadonly() |
||
| 74 | { |
||
| 75 | return false; |
||
| 76 | } |
||
| 77 | |||
| 78 | public function getTemplate() |
||
| 81 | } |
||
| 82 | } |
||
| 83 |