8000 WPML Gutenberg blocks & Blocks reusable with ACF Builder · Issue #123 · StoutLogic/acf-builder · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

WPML Gutenberg blocks & Blocks reusable with ACF Builder #123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mazero opened this issue Aug 12, 2020 · 1 comment
Open

WPML Gutenberg blocks & Blocks reusable with ACF Builder #123

mazero opened this issue Aug 12, 2020 · 1 comment

Comments

@mazero
Copy link
mazero commented Aug 12, 2020

Hello,

I'm using ACF Builder and I'm looking for an easy way to translate my Gutenberg blocks created with it. How can I configure this when creating blocks with acf builder?
At the moment it seems complex... Is there a solution to do what ACF allows when using its UI?

Exemple ... how said this block must be translate with WPML
`<?php

namespace App;
use StoutLogic\AcfBuilder\FieldsBuilder;

$promoicon = ['green' => 'Green'];

$promoblocks = new FieldsBuilder('promoblocks');
$promoblocks
->setLocation('block', '==', 'acf/promoblocks');
$promoblocks
->addText('heading', [ 'label' => 'Heading', 'required' => 1])
->addText('sticktext', [ 'label' => 'Stick Text', 'required' => 0])
->addSelect('promoicon', ['label' => 'Promo Icon','required' => 0, 'choices' => $promoicon,
'default_value' => [], 'allow_null' => 1, 'multiple' => 0, 'return_format' => 'value']);

return $promoblocks; `

Thanks

@mortennh
Copy link
mortennh commented Sep 4, 2020

hi @mazero

you can make use of WPs localization function and write your code like this:

$promoblocks
->addText('heading', [ 'label' => __('Heading', 'your-textdomain'), 'required' => 1])
->addText('sticktext', [ 'label' => __('Stick Text', 'your-textdomain'), 'required' => 0])
->addSelect('promoicon', ['label' =>__('Promo Icon', 'your-textdomain'), 'required' => 0, 'choices' => $promoicon,
'default_value' => [], 'allow_null' => 1, 'multiple' => 0, 'return_format' => 'value']);

return $promoblocks; 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0