Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

ContentAlias element now preserves original values of the aliased element #6638

Closed
wants to merge 1 commit into from
Closed

Conversation

Paratron
Copy link

Ein einfacher fix für bug/request #6622

Das Alias Element überschreibt weiterhin die Werte id, space und cssID - allerdings werden die alten Werte jetzt jeweils in originalId, originalSpace und originalCssID beibehalten, damit Templates von eigen-entwickelten Content Elementen die Inklusion berücksichtigen können.

@leofeyer
Copy link
Member

As far as I see it, we should only implement this if we do not implement #5551.

@leofeyer
Copy link
Member

Implemented in 1a46f5c.

@leofeyer leofeyer closed this Sep 18, 2014
leofeyer pushed a commit to contao/contao that referenced this pull request Aug 20, 2019
Description
-----------

# Issue

(Tested in Contao 4.4)

## How to reproduce

- Create a regular content element (ID 1)
- Create an alias include element (ID 2) that references ID 1
- Create another alias element (ID 3) that references ID 2

Edit the original content element's template to show the element's `origId`, e. g. add:
```
data-id="<?= $this->id ?>" data-orig-id="<?= $this->origId ?>"
```

## Result
```
data-id="1" data-orig-id=""
data-id="2" data-orig-id="1"
data-id="3" data-orig-id="2"
```
The `origId` is always the ID of the included element, not the ID of the original, non-alias element.

## Expected result
```
data-id="1" data-orig-id=""
data-id="2" data-orig-id="1"
data-id="3" data-orig-id="1"
```
The `origId` should be the ID of the original, non-alias element.

# Solution

Check in `Contao\ContentAlias::generate()` whether there already is an `origId` and if there is, use it.

# Context

Commit that introduced `origId`:
7d0e136

PR referenced in the commit:
contao/core#6638

Commits
-------

9c51427 Retain origId in chained alias elements
leofeyer pushed a commit to contao/core-bundle that referenced this pull request Aug 20, 2019
Description
-----------

# Issue

(Tested in Contao 4.4)

## How to reproduce

- Create a regular content element (ID 1)
- Create an alias include element (ID 2) that references ID 1
- Create another alias element (ID 3) that references ID 2

Edit the original content element's template to show the element's `origId`, e. g. add:
```
data-id="<?= $this->id ?>" data-orig-id="<?= $this->origId ?>"
```

## Result
```
data-id="1" data-orig-id=""
data-id="2" data-orig-id="1"
data-id="3" data-orig-id="2"
```
The `origId` is always the ID of the included element, not the ID of the original, non-alias element.

## Expected result
```
data-id="1" data-orig-id=""
data-id="2" data-orig-id="1"
data-id="3" data-orig-id="1"
```
The `origId` should be the ID of the original, non-alias element.

# Solution

Check in `Contao\ContentAlias::generate()` whether there already is an `origId` and if there is, use it.

# Context

Commit that introduced `origId`:
7d0e13604df0bc35a1c9557cf7211c9236ddc4aa

PR referenced in the commit:
contao/core#6638

Commits
-------

9c514271 Retain origId in chained alias elements
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants