wintercms / wintercms/wn-blocks-plugin

[Bug/Feature request] Add compatibility with Translate plugin in Static Pages

Open
#31 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
29
Forks
7
Avg merge
55m
Merged PRs (30d)
1

Description

TL;DR: Winter Translate plugin doesn't work with this plugin in Static Pages, because Translate doesn't understand Blocks' multiple levels system. This makes all Translate fields refer to the same field name, and ends up replacing the values of all form fields within blocks that have the same FormField->fieldName.

Given the following block definition:

name: block
fields:
    content:
        label: Title
        type: mltext
==
<div>{{content}}</div>

Adding two of these blocks to a static page will cause both of them to always have the same value.

Steps:

  1. Add this block to a static page twice with different values
  2. Save and refresh the page
  3. The values of both blocks should be the same as the last block's original value.

This is because Translate will create fields in the forms with the name "RLTranslate[en][content]" for the locale-dependant field.
Furthermore, after saving the default locale's value and refreshing the page, the other locale's value is completely messed up, showing the raw content of the static page of the other locale (static-pages-fr/whatever.htm's content, which is [viewBag] title = "abc" == ).

I have only recently started developping websites using WinterCMS, and tried to fix this for a couple of hours with no success due to my lack of knowledge with its backend / inner workings.

Any kind of fix or workaround would be appreciated, as this is a big blocker for my team right now (even a hardcoded change to a plugin file is fine!).

WinterCMS 1.2.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in a WinterCMS 1.2.6 static page using two instances of the documented block and different values. Trace how Blocks' multiple levels and Translate's RLTranslate field names interact for default and translated locales. Done means each block retains its own value in every locale after saving and refreshing.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
backend, content
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.