Skip to content

Commit

Permalink
Purge view cache an attribute has been changed.
Browse files Browse the repository at this point in the history
The admin preview function does not work as expected: it always fetches
content from the view cache, so the draft content being edited never
shows up.

To fix this issue, view cache should be purged by triggering listeners
attached to `content/cache/translations`.

This PR is related to ezsystems/LegacyBridge#153

| Question           | Answer
| ------------------ | ------------------
| **JIRA issue**     | n/a
| **Bug**            | yes
| **New feature**    | no
| **Target version** | `2017.12`
| **BC breaks**      | no
| **Tests pass**     | yes
| **Doc needed**     | no

**TODO**:
- [ ] Implement feature / fix a bug.
- [ ] Implement tests.
- [ ] Fix new code according to Coding Standards (`$ composer fix-cs`).
- [x] Ask for Code Review.
  • Loading branch information
zerustech committed Jul 9, 2018
1 parent 2cce17c commit c866f6c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/content/attribute_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@
'content/cache/version',
array( $object->attribute( 'id' ), $version->attribute( 'version' ) )
);

ezpEvent::getInstance()->notify(
'content/cache/translations',
array( $object->attribute( 'id' ), $version->attribute( 'version' ) , [$EditLanguage])
);
}

$validation['processed'] = true;
Expand Down

0 comments on commit c866f6c

Please sign in to comment.