Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions modules/backend/formwidgets/Sensitive.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php namespace Backend\FormWidgets;

use Backend\Classes\FormWidgetBase;
use Winter\Storm\Html\Helper as HtmlHelper;

/**
* Sensitive widget.
Expand Down Expand Up @@ -94,6 +95,28 @@ public function onShowValue()
];
}

/**
* @inheritDoc
*/
public function getLoadValue()
{
if ($this->formField->value !== null && $this->formField->value != $this->hiddenPlaceholder) {
return $this->formField->value;
}

$parts = HtmlHelper::nameToArray($this->getFieldName());
array_shift($parts); // remove Model name
$fieldName = array_shift($parts);

$value = $this->model->getAttribute($fieldName);

if (count($parts) && is_array($value)) {
$value = array_get($value, implode('.', $parts));
}

return $value;
}

/**
* @inheritDoc
*/
Expand Down
Loading