πŸ‡¦πŸ‡ΊAustralia @enyug

Account created on 31 May 2022, over 2 years ago
#

Recent comments

πŸ‡¦πŸ‡ΊAustralia enyug

public function revisionOverview(NodeInterface $node) {
    $langcode = $node
      ->language()
      ->getId();
    $langname = $node
      ->language()
      ->getName();
    $languages = $node
      ->getTranslationLanguages();
    $has_translations = count($languages) > 1;
    $node_storage = $this
      ->entityTypeManager()
      ->getStorage('node');
    $build['#title'] = $has_translations ? $this
      ->t('@langname revisions for %title', [
      '@langname' => $langname,
      '%title' => $node
        ->label(),
    ]) : $this
      ->t('Revisions for %title', [
      '%title' => $node
        ->label(),
    ]);

I assume it should be consistence with what implemented in NodeController

πŸ‡¦πŸ‡ΊAustralia enyug

Add revision history title callback

πŸ‡¦πŸ‡ΊAustralia enyug

enyug β†’ made their first commit to this issue’s fork.

πŸ‡¦πŸ‡ΊAustralia enyug

Regarding this:

@enyug is there a particular reason you forked at #224 rather than continuing from #234 or was that a typo?

I notice the changes after #224 prevent showing any other operations for default revision which could have other custom operations for it.

πŸ‡¦πŸ‡ΊAustralia enyug

Hide revert link for latest revision, hide delete link for current revision, also include fix in #249

πŸ‡¦πŸ‡ΊAustralia enyug
   protected function prepareRevision(RevisionableInterface $revision, FormStateInterface $formState): void {
     $revision->setNewRevision();
     $revision->isDefaultRevision(TRUE);
+    assert($revision instanceof TranslatableRevisionableInterface);
+    // Apply the same behaviour in the node revisions.
+    $revision->setRevisionTranslationAffected(TRUE);
     $time = $this->time->getRequestTime();
     if ($revision instanceof EntityChangedInterface) {
       $revision->setChangedTime($time);

Add this to match the behaviours in node revision, fix issue in #138 #145

πŸ‡¦πŸ‡ΊAustralia enyug
    foreach ($entityStorage->loadMultipleRevisions(array_keys($result)) as $revision) {
      // Only show revisions that are affected by the language that is being
      // displayed.
      if (!$translatable || ($revision->hasTranslation($currentLangcode) && $revision->getTranslation($currentLangcode)->isRevisionTranslationAffected())) {
        yield $revision;
      }
    }

Hi: @dpi, This will prevent revision showing which is default revision but has NULL in revision_translation_affected, as mentioned in #138 #145 by @acbramley

Production build 0.71.5 2024