Skip to content

Commit

Permalink
Merge branch 'release-54.28.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Dec 24, 2024
2 parents 6c70089 + 167f439 commit 17da885
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,20 @@ class TranslatedIntoLanguagesSynchronizer
{
private Ontology $ontology;
private ResourceTranslationRepository $resourceTranslationRepository;
private array $callbacks;

public function __construct(Ontology $ontology, ResourceTranslationRepository $resourceTranslationRepository)
{
$this->ontology = $ontology;
$this->resourceTranslationRepository = $resourceTranslationRepository;
}

public function addCallback(string $type, callable $callback): void
{
$this->callbacks[$type] = $this->callbacks[$type] ?? [];
$this->callbacks[$type][] = $callback;
}

public function sync(core_kernel_classes_Resource $resource): void
{
$originalResource = $this->getOriginalResource($resource);
Expand All @@ -58,6 +65,10 @@ public function sync(core_kernel_classes_Resource $resource): void
TaoOntology::LANGUAGE_PREFIX . $translation->getLanguageCode()
);
}

foreach (($this->callbacks[$originalResource->getRootId()] ?? []) as $callback) {
$callback($originalResource);
}
}

private function getOriginalResource(core_kernel_classes_Resource $resource): core_kernel_classes_Resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ private function isBlockedForModification(core_kernel_classes_Property $property
return false;
}

if ($property->getWidget()->getUri() === tao_helpers_form_elements_Readonly::WIDGET_ID) {
return true;
}

if ($this->getFeatureFlagChecker()->isEnabled('FEATURE_FLAG_STATISTIC_METADATA_IMPORT')) {
return $property->isStatistical();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,13 @@ class GenerisInstanceDataBinderTest extends TestCase
/** @var Ontology|MockObject */
private $ontology;

/** @var core_kernel_classes_Property|MockObject */
private $widget;

public function setUp(): void
{
$this->eventManagerMock = $this->createMock(EventManager::class);
$this->widget = $this->createMock(core_kernel_classes_Property::class);

$this->classType1 = $this->createMock(core_kernel_classes_Class::class);
$this->classType1
Expand Down Expand Up @@ -106,6 +110,14 @@ public function setUp(): void
->method('getUri')
->willReturn(self::URI_PROPERTY_2);

$this->property1
->method('getWidget')
->willReturn($this->widget);

$this->property2
->method('getWidget')
->willReturn($this->widget);

$this->target
->method('getUri')
->willReturn('http://test/resource');
Expand Down

0 comments on commit 17da885

Please sign in to comment.