-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Category Picker doesn't update values on Inline Blocks (CMS 12.22.2) #22
Comments
Inline blocks is great feature rushed out too fast.. :) |
As an update, I ended up writing an interim attribute for use on Inline Blocks based on the /// <summary>
/// Cloned and cut down from the [Categories] attribute as it does not update when used on inline blocks.
/// </summary>
[Obsolete("This is a temporary fix for Category pickers on inline blocks not working and should be replaced with [Categories] once a fix is live. See: https://github.com/Geta/geta-optimizely-categories/issues/22")]
[AttributeUsage(AttributeTargets.Property)]
public class InlineBlockCategoriesAttribute : Attribute, IDisplayMetadataProvider, IMetadataDetailsProvider
{
private readonly IEnumerable<IContentRepositoryDescriptor> _contentRepositoryDescriptors;
public InlineBlockCategoriesAttribute()
: this(ServiceProviderExtensions.GetInstance<IEnumerable<IContentRepositoryDescriptor>>(ServiceLocator.Current))
{
}
public InlineBlockCategoriesAttribute(IEnumerable<IContentRepositoryDescriptor> contentRepositoryDescriptors)
{
this._contentRepositoryDescriptors = contentRepositoryDescriptors;
}
public void CreateDisplayMetadata(DisplayMetadataProviderContext context)
{
if (!(context.DisplayMetadata.AdditionalValues[(object)"epi:extendedmetadata"] is ExtendedMetadata additionalValue))
return;
var repositoryDescriptor = _contentRepositoryDescriptors.First(x => x.Key == CategoryContentRepositoryDescriptor.RepositoryKey);
additionalValue.EditorConfiguration["roots"] = (object)repositoryDescriptor.Roots;
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We have the following block that we use for building up filters:
When creating this as a shared block (e.g. created under For This Site, For This Page) then the category picker works as intended and results in changes to the category picker being retained.
When creating this as an inline block directly in the content area, then only the categories set at the point of creation are applied. Any further updates to these on the block are not retained.
Steps to Reproduce:
I have also noted the same issue if I try and use the same block in a new block property list, e.g.
The text was updated successfully, but these errors were encountered: