Open SantinoPetrovic opened 7 years ago
Anyways, it looks like I were 36 commits behind and older bolt system (3.2.14), so don't mind this issue :)
Hi Santino,
I know Svante worked on fixed for templatefields before.
I’ll check If it works with the latest versions, and If so i’ll close the issue
Also having this issue. Bolt 3.4.8, php 7.0
theme.yml:
templates/blocks/footer-links_block.twig:
footer_links:
type: repeater
label: Footer Link Entries
initial: 6
fields:
footer_entry_name:
type: text
label: Name
footer_entry_link:
type: text
label: Link This Icon Will Lead To
footer_entry_icon:
type: image
label: Logo Or Icon For Entry
attrib: alt
extensions: [jpg, png, gif]
contenttype.yml:
blocks:
name: Blocks
singular_name: Block
fields:
locale:
type: locale
group: "Block"
title:
type: text
group: "Block"
slug:
type: slug
uses: [ title ]
template:
type: templateselect
translatable: true
filter: '*_block.twig'
postfix: <p>Please do not change this value.</p>
readonly: true
usdata:
type: hidden
usslug:
type: locale_data
index: true
endata:
type: hidden
enslug:
type: locale_data
index: true
audata:
type: hidden
auslug:
type: locale_data
index: true
nzdata:
type: hidden
nzslug:
type: locale_data
index: true
Repro steps:
In the back end:
I add data to the (templatefield) repeater field of Locale 1 & save page. Go to (previously empty) locale 2 and all the data is copied over (loading http://page/locale 2 also shows data from locale 1). I edit an entry in the repeaterfield of Locale 2 that has been auto populated & save page. Change to locale 2 saves, Locale 1 is now completely blanked.
Here's my {{ dump(repeater) }} (trimmed), after the above steps have taken place.
+"localeValues": array:20 [▼
"id" => "3"
"slug" => "footer-links"
"datecreated" => "2018-02-27 13:28:10"
"datechanged" => "2018-02-28 12:55:52"
"datepublish" => "2018-02-27 13:28:04"
"datedepublish" => null
"ownerid" => "1"
"status" => "published"
"templatefields" => "{"footer_links":"{}"}"
"title" => "Footer Links"
"template" => "templates/blocks/footer-links_block.twig"
"usdata" => "[]"
"usslug" => "footer-links"
"endata" => "{"templatefields":{"footer_links":[{ // Removed data for simplicity, has all data added to EN translation //]}"
"enslug" => "footer-links"
"audata" => "{"templatefields":{"footer_links":[{" // Removed data for simplicity, has all data added to US translation Plus change made to AU translation // }]"
"auslug" => "footer-links"
"nzdata" => null
"nzslug" => ""
"locale" => ""
]
}
I’ll look into this, will post the findings next week!
Thanks for reporting
Op 28 februari 2018 om 14:57:04, Matthew (notifications@github.com) schreef:
Also having this issue. Bolt 3.4.8, php 7.0
theme.yml:
templates/blocks/footer-links_block.twig: footer_links: type: repeater label: Footer Link Entries initial: 6 fields: footer_entry_name: type: text label: Name footer_entry_link: type: text label: Link This Icon Will Lead To footer_entry_icon: type: image label: Logo Or Icon For Entry attrib: alt extensions: [jpg, png, gif]
contenttype.yml:
blocks: name: Blocks singular_name: Block fields: locale: type: locale group: "Block" title: type: text group: "Block" slug: type: slug uses: [ title ] template: type: templateselect translatable: true filter: '*_block.twig' postfix:
Please do not change this value.
readonly: true
usdata: type: hidden usslug: type: locale_data index: true endata: type: hidden enslug: type: locale_data index: true audata: type: hidden auslug: type: locale_data index: true nzdata: type: hidden nzslug: type: locale_data index: true
Repro steps:
In the back end:
I add data to the (templatefield) repeater field of Locale 1 & save page. Go to (previously empty) locale 2 and all the data is copied over (loading http://page/locale 2 also shows data from locale 1). I edit an entry in the repeaterfield of Locale 2 that has been auto populated & save page. Change to locale 2 saves, Locale 1 is now completely blanked.
Here's my {{ dump(repeater) }} (trimmed), after the above steps have taken place.
+"localeValues": array:20 [▼ "id" => "3" "slug" => "footer-links" "datecreated" => "2018-02-27 13:28:10" "datechanged" => "2018-02-28 12:55:52" "datepublish" => "2018-02-27 13:28:04" "datedepublish" => null "ownerid" => "1" "status" => "published" "templatefields" => "{"footer_links":"{}"}" "title" => "Footer Links" "template" => "templates/blocks/footer-links_block.twig" "usdata" => "[]" "usslug" => "footer-links" "endata" => "{"templatefields":{"footer_links":[{ // Removed data for simplicity, has all data added to EN translation //]}" "enslug" => "footer-links" "audata" => "{"templatefields":{"footer_links":[{" // Removed data for simplicity, has all data added to US translation Plus change made to AU translation // }]" "auslug" => "footer-links" "nzdata" => null "nzslug" => "" "locale" => "" ] }
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/BoltTranslate/Translate/issues/156#issuecomment-369246486, or mute the thread https://github.com/notifications/unsubscribe-auth/AV9TRE_BFTF9s5vvdeic3ESs-lExAmE1ks5tZVswgaJpZM4QIpkl .
Hi,
This bug is still happening for me (4.1.6). I have been to resolve the issue by replacing line 237 in src/EventListener/StorageListener.php with the following condition:
if ($field === 'templatefields') {
$record->set($field, $defaultContent->get($field)->serialize());
} else {
$record->set($field, $defaultContent->get($field));
}
UPDATE: When I save non-default content that contains a repeater field which has a date field, I get an error when I try to edit the default content (cannot cast array to string in vendor/twig/twig/lib/Twig/Extension/Core.php line 453):
"start_date\":{\"date\":\"2019-01-15 00:00:00.000000\",\"timezone_type\":3,\"timezone\":\"EST\"}
instead of this
"start_date\":\"2019-01-01\"
I think that serialize() tries to save a Carbon object instead of the actual date value.
My temporary fix: vendor/twig/twig/lib/Twig/Extension/Core.php line 453
if (is_array($date) && isset($date['date'])) {
$date = $date['date'];
}
Hi!
I try to use the translate extension for template select field, and it works perfectly for all subfield I've in my template fields, except for repeaters. When I try to save the other locales with values on the repeater in a record, the default locale drops its templateselect repeater values. However, if I save default locale only, it doesn't drop it.
This is the code I use:
Contenttypes.yml:
Theme.yml:
Translate config file:
If I find a solution, I will reply.
Best regards,
Santino Petrovic