Try our conversational search powered by Generative AI!

Seprator/Divider custom property

Vote:
 

Hi, 

I want to display horizontal line in Edit mode so i have created one custom property and but when i debug a code, it doesn't call CreatePropertyControl(). It was working in EpiServer6R2 but not in 7.5.

Can you please suggest any solution?

#111626
Oct 16, 2014 17:22
Vote:
 

Edit mode has drastically changed from EPiServer 6 R2 to 7.5. I would suggest that you don't port your custom property to 7.5, but rather use the GroupName parameter in the Display attribute of the property in order to group your properties into the appropriate tab or "section".

See: http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/75/Content/Attributes/#PropertyAttributes

#111628
Oct 16, 2014 17:48
Vote:
 

Here is a very simple version we did

(Template.html)

<div>
    <hr/>
</div>

main.js

define([
    "dojo/_base/array",
    "dojo/_base/connect",
    "dojo/_base/declare",
    "dojo/_base/lang",

    "dijit/_CssStateMixin",
    "dijit/_Widget",
    "dijit/_TemplatedMixin",
    "dijit/_WidgetsInTemplateMixin",
    "dijit/form/Textarea",

    "epi/epi",
    "epi/shell/widget/_ValueRequiredMixin"
],
function (
    array,
    connect,
    declare,
    lang,

    _CssStateMixin,
    _Widget,
    _TemplatedMixin,
    _WidgetsInTemplateMixin,

    Textarea,
    epi,
    _ValueRequiredMixin
) {

    return declare("customer.editors.Separator.Main", [_Widget, _TemplatedMixin, _WidgetsInTemplateMixin, _CssStateMixin, _ValueRequiredMixin], {

        templatePath: dojo.moduleUrl('active.editors.Separator', 'Template.html'),

        intermediateChanges: false,
        value: null,
        multiple: true,
        baseClass: "epiLongString",

        onChange: function (value) {
            // Event
        },

        postCreate: function () {
            // call base implementation
            this.inherited(arguments);
        },

        isValid: function () {
            return true;
        },

        // Setter for value property
        _setValueAttr: function (value) {
            this._setValue(value);
        },

        _setReadOnlyAttr: function (value) {
            this._set("readOnly", value);
        },

        // Setter for intermediateChanges
        _setIntermediateChangesAttr: function (value) {
            this._set("intermediateChanges", value);
        },

        // Event handler for textarea
        _onTextAreaChanged: function (value) {
            this._setValue(value, false);
        },

        _setValue: function (value) {
            this.value = value;
        },
    });
});

SeperatorEditorDescriptor.cs

using System;
using System.Collections.Generic;
using EPiServer.Shell.ObjectEditing;
using EPiServer.Shell.ObjectEditing.EditorDescriptors;

namespace Customer.Web.Framework.EditorDescriptors.Separator
{
    [EditorDescriptorRegistration(TargetType = typeof(string), UIHint = Global.SiteUIHints.Separator)]
    public class SeparatorEditorDescriptor : EditorDescriptor
    {
        public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
        {
            ClientEditingClass = "customer.editors.separator.main";
            base.ModifyMetadata(metadata, attributes);
        }
    }
}

Read more on how to create custom properties here:

tedgustaf.com/sv/blogg/2014/6/create-an-episerver-widget-for-edit-mode/

Good luck!

#111631
Oct 16, 2014 18:26
Vote:
 

Worked !!!

Thank you very much Henrik.

#111683
Oct 17, 2014 13:41
Vote:
 

Great Komal!

Please mark my response as Answer so others can see that the thread is answerd

#111694
Oct 17, 2014 14:36
Vote:
 

This is an old pretty 'ugly' solution to the problem of grouping.

Grouped properties are mostly used by the same function, it would be better if your were able to group these using Blocks as Properties instead.

#111695
Oct 17, 2014 14:42
Vote:
 

True Alf, but it is a quick fix in a migration project and after that look at each place it is being used and se if it is still needed with the new better onpage editor.

we have the code but does not use it anymore.

#111700
Oct 17, 2014 15:38
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.