2023-02-13 14:47:26 +01:00
|
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
|
2023-08-09 11:47:45 +02:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
|
using Umbraco.Cms.Core.Configuration.Models;
|
2023-02-13 14:47:26 +01:00
|
|
|
|
using Umbraco.Cms.Core.Models;
|
|
|
|
|
|
using Umbraco.Cms.Core.Models.Blocks;
|
|
|
|
|
|
using Umbraco.Cms.Core.Serialization;
|
|
|
|
|
|
using Umbraco.Cms.Core.Services;
|
2023-08-09 11:47:45 +02:00
|
|
|
|
using Umbraco.Cms.Web.Common.DependencyInjection;
|
2023-02-13 14:47:26 +01:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Cms.Core.PropertyEditors;
|
|
|
|
|
|
|
|
|
|
|
|
internal sealed class BlockValuePropertyIndexValueFactory :
|
|
|
|
|
|
NestedPropertyIndexValueFactoryBase<BlockValue, BlockItemData>,
|
|
|
|
|
|
IBlockValuePropertyIndexValueFactory
|
|
|
|
|
|
{
|
|
|
|
|
|
private readonly IContentTypeService _contentTypeService;
|
|
|
|
|
|
|
2023-08-09 11:47:45 +02:00
|
|
|
|
public BlockValuePropertyIndexValueFactory(
|
|
|
|
|
|
PropertyEditorCollection propertyEditorCollection,
|
|
|
|
|
|
IContentTypeService contentTypeService,
|
|
|
|
|
|
IJsonSerializer jsonSerializer,
|
|
|
|
|
|
IOptionsMonitor<IndexingSettings> indexingSettings)
|
|
|
|
|
|
: base(propertyEditorCollection, jsonSerializer, indexingSettings)
|
|
|
|
|
|
{
|
|
|
|
|
|
_contentTypeService = contentTypeService;
|
|
|
|
|
|
}
|
2023-02-13 14:47:26 +01:00
|
|
|
|
|
2023-08-09 11:47:45 +02:00
|
|
|
|
[Obsolete("Use non-obsolete constructor. This will be removed in Umbraco 14.")]
|
2023-02-13 14:47:26 +01:00
|
|
|
|
public BlockValuePropertyIndexValueFactory(
|
|
|
|
|
|
PropertyEditorCollection propertyEditorCollection,
|
|
|
|
|
|
IContentTypeService contentTypeService,
|
|
|
|
|
|
IJsonSerializer jsonSerializer)
|
2023-08-09 11:47:45 +02:00
|
|
|
|
: this(propertyEditorCollection, contentTypeService, jsonSerializer, StaticServiceProvider.Instance.GetRequiredService<IOptionsMonitor<IndexingSettings>>())
|
2023-02-13 14:47:26 +01:00
|
|
|
|
{
|
|
|
|
|
|
_contentTypeService = contentTypeService;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override IContentType? GetContentTypeOfNestedItem(BlockItemData input) =>
|
|
|
|
|
|
_contentTypeService.Get(input.ContentTypeKey);
|
|
|
|
|
|
|
|
|
|
|
|
protected override IDictionary<string, object?> GetRawProperty(BlockItemData blockItemData) =>
|
|
|
|
|
|
blockItemData.RawPropertyValues;
|
|
|
|
|
|
|
|
|
|
|
|
protected override IEnumerable<BlockItemData> GetDataItems(BlockValue input) => input.ContentData;
|
|
|
|
|
|
}
|