Skip to content

Commit

Permalink
Fix ACF flexible unnecessary outgoing data
Browse files Browse the repository at this point in the history
  • Loading branch information
Narek13 committed Feb 4, 2021
1 parent efc6cb2 commit 9595cad
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
10 changes: 9 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: translation, api, I18N
Donate link: https://eurotext-ecommerce.com
Requires at least: 4.6
Tested up to: 5.5.3
Stable tag: 1.3.2
Stable tag: 1.3.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -118,6 +118,14 @@ Just send an email to [email protected] with a request.
3. project view

== Changelog ==
= 1.3.4 =
* Fix bugs with ACF fields

= 1.3.3 =
* Fix “Bulk Translate” action for custom post types
* Fix WP VIP warning about content filtering
* Fix bugs with ACF fields

= 1.3.2 =
* Fix missing libraries from vendor folder

Expand Down
7 changes: 4 additions & 3 deletions src/Module/ACF/Processor/OutgoingMetaProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public function processOutgoing(Translation $translation)

$fields = get_field_objects($sourcePostId);
$acfFields = $this->addACFFieldKeys($fields, [], $sourcePostId);
$toNotTranslate = $acfFields['to-not-translate'];

$toNotTranslate = $acfFields['to-not-translate'] ?? [];
unset($acfFields['to-not-translate']);
if (!empty($acfFields)) {
$translation->set_value(Integrator::ACF_FIELDS, $acfFields, self::_NAMESPACE);
Expand Down Expand Up @@ -96,19 +97,19 @@ protected function addACFFieldKeys(array $fields, array $keys, $postID)
$foundKeys = $this->recursivelyFindLayoutFieldKeys($field['value'], $field['name'], $postID);
foreach ($foundKeys as $key => $value) {
$fieldType = $this->getFieldTypeByKey($key, $postID);
//var_dump($fieldType, $key);
if ($fieldType === self::FIELD_TYPE_REPEATER && !empty($value)) {
$keys['to-not-translate'][$key] = count($value);
continue;
}

if ($fieldType === self::FIELD_TYPE_GROUP) {
if ($fieldType === self::FIELD_TYPE_GROUP || $fieldType === self::FIELD_TYPE_FLEXIBLE) {
continue;
}

$keys[$key] = $value;
}
if ($field['type'] === self::FIELD_TYPE_FLEXIBLE) {
$layoutArr = [];
foreach ($field['value'] as $value) {
if (isset($value['acf_fc_layout'])) {
$layoutArr[] = $value['acf_fc_layout'];
Expand Down
2 changes: 1 addition & 1 deletion translationmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: translationMANAGER
* Plugin URI: https://eurotext.de/en
* Description: Translate your content from a WordPress Multisite and MultilingualPress.
* Version: 1.3.2
* Version: 1.3.4
* Author: Inpsyde
* Author URI: https://inpsyde.com/
* Text Domain: translationmanager
Expand Down

0 comments on commit 9595cad

Please sign in to comment.