5

I have component

manifest.addComponent({
  name: 'MyComponentWithPlaceholder',
  icon: SitecoreIcon.DocumentTag,
  fields: [
    { name: 'heading', type: CommonFieldTypes.SingleLineText },
  ],
  placeholders: ['my-placeholder']
});

with implementation

const MyComponentWithPlaceholder = (props) => (
  <div>
    <p>My component with <strong>Placeholder</strong></p>
    <Text field={props.fields.heading} />
    <Placeholder name='my-placeholder' rendering={props.rendering} />
  </div>
);

and my-placeholder field Allowed Controls filled with some components...

Field Allowed Controls in my-placeholder item

But, when I'm trying to add this component to layout in experience editor, inner placeholder my-placeholder is behaving like it did not contain any allowed controls.

Empty dialog

However, after saving state of layout (in experience editor), my-placeholder let me correctly select component, that I'm allowed to add to parent component.

What I'm doing wrong? I don't want to save layout state after every added component.

  • 2
    I have the same, and use the save workaround. – Jan Bluemink Feb 19 '19 at 14:20
  • According Sitecore Support there is another workaround that can sometimes fit your needs. You can add a next placeholder settings with undefined key where you can set the allowed components. Of course, this will apply for all inner placeholders then in the same manner. – rene naplava Mar 22 '19 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.