diff --git a/CHANGELOG.md b/CHANGELOG.md index f6a9c9ed9..89b837fef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Added new properties to RelationController: readOnly, showSorting, defaultSort. - Hashable, Sluggable, Purgeable and Validation traits must now be used in the Model class definition. - Plugins can now extend existing Back-end navigation menu items, see Event docs for an example. + - Required form fields now sport an asterisk (*) character at the end of their label. * **Build 116** (2014-07-07) - Added new layout and page method `onInit()` called after components are initialized and before AJAX requests are processed. diff --git a/modules/backend/assets/css/october.css b/modules/backend/assets/css/october.css index 4b41dcee0..b614c31f5 100644 --- a/modules/backend/assets/css/october.css +++ b/modules/backend/assets/css/october.css @@ -8159,8 +8159,9 @@ label { .form-group.is-required > label:after { color: #ff0000; vertical-align: super; - font-size: 50%; + font-size: 60%; content: " *"; + text-shadow: 0 0 2px #b30000; } .form-group.span-full { width: 100%; diff --git a/modules/backend/assets/less/controls/forms.less b/modules/backend/assets/less/controls/forms.less index 62875db49..4afe2ac04 100644 --- a/modules/backend/assets/less/controls/forms.less +++ b/modules/backend/assets/less/controls/forms.less @@ -99,8 +99,9 @@ label { > label:after { color: @color-form-required-asterisk; vertical-align: super; - font-size: 50%; + font-size: 60%; content: " *"; + text-shadow: 0 0 2px darken(@color-form-required-asterisk, 15%); } } diff --git a/modules/backend/widgets/Form.php b/modules/backend/widgets/Form.php index 236e9ab20..44aaec537 100644 --- a/modules/backend/widgets/Form.php +++ b/modules/backend/widgets/Form.php @@ -487,6 +487,12 @@ class Form extends WidgetBase */ $field->value = $this->getFieldValue($field); + /* + * Check model if field is required + */ + if (!$field->required && $this->model && method_exists($this->model, 'isAttributeRequired')) + $field->required = $this->model->isAttributeRequired($field->columnName); + /* * Get field options from model */ diff --git a/modules/backend/widgets/form/partials/_field.htm b/modules/backend/widgets/form/partials/_field.htm index 901a4d364..b66aba0e2 100644 --- a/modules/backend/widgets/form/partials/_field.htm +++ b/modules/backend/widgets/form/partials/_field.htm @@ -7,7 +7,6 @@ label): ?>