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 Buildplan/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ RUN service mysql start && cd ${WP_INSTALL_DIR} && \
${WPCLI} core multisite-convert && \
IFS=',' read -a array <<< "${SITES}"; for site in "${array[@]}"; do ${WPCLI} site create --slug="${site##*\:}" --title="${site%%\:*}" --email=test@wp.org; done && \
IFS=';' read -a array <<< "${DEPENDENCIES}"; for plugin_name in "${array[@]}"; do ${WPCLI} plugin install $plugin_name --activate-network; done && \
if [ "latest" != "${ACF_PRO_VERSION}" ]; then DLINK="${DLINK}&t=${ACF_PRO_VERSION}"; fi && \
DLINK="https://connect.advancedcustomfields.com/index.php?a=download&p=pro&k=${ACFPRO_KEY}" && \
if [ "latest" != "${ACF_PRO_VERSION}" ]; then DLINK="${DLINK}&t=${ACF_PRO_VERSION}"; fi && \
Comment on lines -75 to +76
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes it possible to actually use the variable

BUILD_FQFN="${WP_INSTALL_DIR}/advanced-custom-fields-pro.zip" && \
curl ${DLINK} --output ${BUILD_FQFN} && \
${WPCLI} plugin install ${BUILD_FQFN} --activate-network && \
Expand Down
10 changes: 6 additions & 4 deletions inc/Smartling/Extensions/Acf/AcfDynamicSupport.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,12 @@ private function getFieldsFromPosts(array $posts): array
{
$fields = [];
foreach ($posts as $post) {
$configuration = unserialize($post->post_content);
$fields[$post->post_name] = [
'type' => $configuration['type'],
];
$configuration = unserialize($post->post_content, ['allowed_classes' => false]);
$fieldData = ['type' => $configuration['type']];
if ($configuration['type'] === 'clone' && array_key_exists('clone', $configuration)) {
$fieldData['clone'] = $configuration['clone'];
}
$fields[$post->post_name] = $fieldData;
$subFields = $this->rawReadFields($post->ID);
if (0 < count($subFields)) {
$fields = array_merge($fields, $subFields);
Expand Down
15 changes: 15 additions & 0 deletions tests/IntegrationTests/tests/AdvancedCustomFieldsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,16 @@ public function testAdvancedCustomFields()
$categorySubmission = ArrayHelper::first($submissions);

$expectedMetadata = $this->getMetadata($categorySubmission->getTargetId(), $attachmentSubmission->getTargetId());
$translatedFields = [
'text_field',
'html_field',
'repeater_field_0_repeater_text_field',
'flexible_content_field_0_flexible_content_text_field',
'flexible_content_field_1_flexible_content_text_field',
];
foreach ($translatedFields as $field) {
unset($expectedMetadata[$field]);
}

$submissions = $this->getSubmissionManager()->find(
[
Expand All @@ -148,6 +158,11 @@ public function testAdvancedCustomFields()
}
unset($realMetadatum);

foreach ($translatedFields as $translatedField) {
self::assertArrayHasKey($translatedField, $realMetadata, "$translatedField must exist in target metadata after translation");
self::assertNotEmpty($realMetadata[$translatedField], "$translatedField must be non-empty after translation");
}

foreach ($expectedMetadata as $eKey => $eValue) {
self::assertArrayHasKey($eKey, $realMetadata);

Expand Down
Loading