I'm creating a custompropertyeditor called buttonLink which I can use in a grid in Umbraco 8.9.1.
So far I'm able to create one which looks good in the backend, meaning I can pick a content item, but when saving (or previewing) I see the selected vlaue is not stored/retainded. The other value "Button text" is stored.
What do I need to change ?
\gridpropertyeditors\LinkButton.cshtml
<div ng-controller="Positioner.LinkButtonController">
<div>
<label>
Button text
</label>
<br />
<input type="text" rows="1"
class="umb-property-editor umb-textstring textstring"
umb-auto-resize
umb-auto-focusclass="textstring input-block-level" ng-model="control.value.buttonText" placeholder="Button text" /><br /><br />
</div>
<div class="linkbutton-row">
<label>internal link: </label>
<div>
<umb-property-editor model="contentPicker" ng-model="control.value.buttonLink"></umb-property-editor>
</div>
</div>
</div>
js\LinkButtonController.controller.js
angular.module("umbraco")
.controller("Positioner.LinkButtonController", function ($scope) {
$scope.contentPicker = {
view: 'contentPicker',
config: {
minNumber: 0,
maxNumber: 1
},
value: $scope.model.value.InternalLink
};
});
\linkButton.cshtml (I just want to see what is stored here ...)
@inherits Umbraco.Web.Mvc.UmbracoViewPage<dynamic>
@using Umbraco.Web.Templates
@Model
When you press save in the backoffice, then whatever the value of $scope.model.value is for your custom property editor, is the value that gets persisted to the database.
So I'm not sure from the parts of the files that you have posted need to be updated, there is a gist here of using a Content Picker in a custom property editor:
Thanks for your feedback and the example, tried it in Umbraco 8 but not much happening (can't even pick content) I'm afraid this is developed for Umbraco 7 and things changed a bit.
Using Content picker in
I'm creating a custompropertyeditor called buttonLink which I can use in a grid in Umbraco 8.9.1.
So far I'm able to create one which looks good in the backend, meaning I can pick a content item, but when saving (or previewing) I see the selected vlaue is not stored/retainded. The other value "Button text" is stored.
What do I need to change ?
Hi Patrick
When you press save in the backoffice, then whatever the value of $scope.model.value is for your custom property editor, is the value that gets persisted to the database.
So I'm not sure from the parts of the files that you have posted need to be updated, there is a gist here of using a Content Picker in a custom property editor:
https://gist.github.com/abjerner/a2b1cf55eab147dbcff2b68e79e04090
that might give you a bit of a steer...
regards
marc
Thanks for your feedback and the example, tried it in Umbraco 8 but not much happening (can't even pick content) I'm afraid this is developed for Umbraco 7 and things changed a bit.
is working on a reply...