Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I started working with Umbraco 15 and implementing Block Grid backoffice view following this tutorial: https://docs.umbraco.com/umbraco-cms/tutorials/creating-custom-views-for-blocklist
But property:
@property({ attribute: false }) settings?: UmbBlockDataType;
Is always undefined.
This is my module:
import { html, customElement, LitElement, property } from '@umbraco-cms/backoffice/external/lit'; import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api'; import type { UmbBlockEditorCustomViewElement } from '@umbraco-cms/backoffice/block-custom-view'; import { type UmbBlockDataType } from '@umbraco-cms/backoffice/block'; // UmbBlockDataType @customElement('button-component') export class ButtonBlockCustomView extends UmbElementMixin(LitElement) implements UmbBlockEditorCustomViewElement { @property({ attribute: false }) content?: UmbBlockDataType; @property({ attribute: false }) settings?: UmbBlockDataType; getSizeFromSettings(size:string) { if (!size || size.trim() === '') return ''; switch (size) { case 'large': return ' btn--lg'; case 'medium': return ' btn--md'; case 'small': return ' btn--sm'; default: return ''; } } override render() { debugger; const sizeClass = this.getSizeFromSettings(this.settings?.size as string); const link: {name: string}[] = this.content?.link as {name: string}[]; return html` <link rel="stylesheet" href="/assets/css/styles/allstyles.css" /> <a class="btn btn--primary ${sizeClass}"> ${link[0].name ? html`<span>${link[0].name}</span>` : ''} ${this.settings?.buttonArrow ? html` <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none"> <path fill="#1C2541" fill-rule="evenodd" d="M12.075 5.576a.6.6 0 0 0 0 .848l4.976 4.976H6a.6.6 0 1 0 0 1.2H17.05l-4.976 4.976a.6.6 0 0 0 .849.848l6-6a.6.6 0 0 0 0-.848l-6-6a.6.6 0 0 0-.849 0Z" clip-rule="evenodd" ></path> </svg> ` : ''} </a> `; } } export default ButtonBlockCustomView;
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Umbraco Block Grid backoffice custom view the settings property is always undefined for Umbraco 15
I started working with Umbraco 15 and implementing Block Grid backoffice view following this tutorial: https://docs.umbraco.com/umbraco-cms/tutorials/creating-custom-views-for-blocklist
But property:
Is always undefined.
This is my module:
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.