Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "smartling/wordpress-connector",
"license": "GPL-2.0-or-later",
"version": "5.4.0",
"version": "5.5.0",
"description": "",
"type": "wordpress-plugin",
"repositories": [
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: translation, localization, multilingual, internationalization, smartling
Requires at least: 5.5
Tested up to: 6.9
Requires PHP: 8.0
Stable tag: 5.4.0
Stable tag: 5.5.0
License: GPLv2 or later

Translate content in WordPress quickly and seamlessly with Smartling, the industry-leading Translation Management System.
Expand Down Expand Up @@ -62,6 +62,9 @@ Additional information on the Smartling Connector for WordPress can be found [he
3. Track translation status within WordPress from the Submissions Board. View overall progress of submitted translation requests as well as resend updated content.

== Changelog ==
= 5.5.0 =
* Reworked ACF configuration ingestion to improve image attachments not being found in ACF fields nested in repeater, group, or flexible_content layouts

= 5.4.0 =
* Added support for Elementor 4

Expand Down
2 changes: 1 addition & 1 deletion smartling-connector.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* Plugin Name: Smartling Connector
* Plugin URI: https://www.smartling.com/products/automate/integrations/wordpress/
* Description: Integrate your WordPress site with Smartling to upload your content and download translations.
* Version: 5.4.0
* Version: 5.5.0
* Author: Smartling
* Author URI: https://www.smartling.com
* License: GPL-2.0+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

add_action('init', function () {
if (function_exists('acf_add_local_field_group')):
acf_add_local_field_group(array(
$group = array(
'key' => 'group_5ad066ba13486',
'title' => 'ACF Test Group',
'fields' => array(
Expand Down Expand Up @@ -444,8 +444,16 @@
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));

);
acf_add_local_field_group($group);
// Persist the group + fields to the DB once so the Smartling connector's
// DB-only definition walker (AcfDynamicSupport::collectAcfDefinitions) sees them.
if (function_exists('acf_get_field_group_post')
&& function_exists('acf_import_field_group')
&& !acf_get_field_group_post($group['key'])
) {
acf_import_field_group($group);
}
endif;


Expand Down
66 changes: 0 additions & 66 deletions tests/Smartling/Extensions/Acf/AcfTypeDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,20 @@
use PHPUnit\Framework\TestCase;
use Smartling\Extensions\Acf\AcfDynamicSupport;
use Smartling\Extensions\Acf\AcfTypeDetector;
use Smartling\Helpers\ArrayHelper;
use Smartling\Helpers\Cache;
use Smartling\Helpers\ContentHelper;
use Smartling\Helpers\MetaFieldProcessor\BulkProcessors\MediaBasedProcessor;
use Smartling\Helpers\SiteHelper;
use Smartling\Helpers\WordpressFunctionProxyHelper;
use Smartling\Helpers\WpObjectCache;
use Smartling\Processors\ContentEntitiesIOFactory;
use Smartling\Settings\SettingsManager;
use Smartling\Submissions\SubmissionManager;
use Smartling\Tests\Mocks\WordpressFunctionsMockHelper;

class AcfTypeDetectorTest extends TestCase
{
private $acfStores;
protected function setUp(): void
{
global $acf_stores;
$this->acfStores = $acf_stores;
WordpressFunctionsMockHelper::injectFunctionsMocks();
}

protected function tearDown(): void
{
global $acf_stores;
$acf_stores = $this->acfStores;
}

/**
* @dataProvider providerGetProcessorByMetaFields
*/
Expand Down Expand Up @@ -74,56 +60,4 @@ private function providerGetProcessorByMetaFields()
];
}

public function testGetProcessorForGutenberg()
{
global $acf_stores;
if (!class_exists('ACF_Data')) {
$this->markTestSkipped('No ACF data found. This is ok when running tests with no ACF plugin or no wordpress loaded. The test will work when running as part of integration suite.');
}
$groups = $this->createPartialMock('ACF_Data', ['get_data']);
$groups->method('get_data')->willReturn([]);
$fields = $this->createPartialMock('ACF_Data', ['get_data']);
$fields->method('get_data')->willReturn([
'field_5eb1344b55a84' => [
'global_type' => 'field',
'type' => 'image',
'name' => 'media',
'key' => 'field_5eb1344b55a84',
'parent' => '',
]
]);
$acf_stores = [
'local-groups' => $groups,
'local-fields' => $fields,
];

$settingsManager = $this->getMockBuilder(SettingsManager::class)->disableOriginalConstructor()->getMock();
$settingsManager->method('getActiveProfiles')->willReturn([]);
$siteHelper = $this->createMock(SiteHelper::class);
$siteHelper->method('listBlogs')->willReturn([]);

$ads = new AcfDynamicSupport(
new ArrayHelper(),
$settingsManager,
$siteHelper,
$this->createMock(SubmissionManager::class),
new WordpressFunctionProxyHelper(),
);
$ads->run();

$fields = json_decode('{"entity\/post_content\/acf\/testimonial\/data\/media":"297",' .
'"entity\/post_content\/acf\/testimonial\/data\/_media":"field_5eb1344b55a84"}', true);
self::assertInstanceOf(
MediaBasedProcessor::class,
(new AcfTypeDetector(
$ads,
new WpObjectCache(),
new ContentHelper(
$this->createMock(ContentEntitiesIOFactory::class),
$siteHelper,
new WordpressFunctionProxyHelper(),
)
))->getProcessorForGutenberg(array_keys($fields)[0], $fields)
);
}
}