Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Patrick van Kemenade 63 posts 257 karma points
    1 week ago
    Patrick van Kemenade
    0

    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
    
  • Marc Goodson 1390 posts 9427 karma points MVP 5x c-trib
    1 week ago
    Marc Goodson
    1

    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

  • Patrick van Kemenade 63 posts 257 karma points
    1 week ago
    Patrick van Kemenade
    0

    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.

Please Sign in or register to post replies

Write your reply to:

Draft