'cube-link-carousel' => [
'links' => [
'title' => self::TYPE_TEXT,
- 'url' => self::TYPE_TEXT,
+ 'link.url' => self::TYPE_TEXT,
],
],
'cube-photo-grid' => [
$widget_type = trim($row['widget']);
$field_name = trim($row['field']);
$content = trim($row['translation']);
+
+ // Fallback to using content in original column in case translation hasn't been filled in
+ if (empty($content) && key_exists('content', $row)) {
+ $content = $row['content'];
+ }
+
$this->update_element($this->data, $element_ID, $widget_type, $field_name, $content);
}
preg_match('/(?<field>[a-z0-9\-_\.]+)(?:#(?<id>[a-z0-9]+))?(?:\.(?<subfield>[a-z\-_\.]+))?/', $field_name, $matches);
extract($matches); // For easier access to $field, $id and $subfield
- if (empty($field)) return $element; // Bail out if at least the field isn't found
+ // Convert to Arrays object so we can check for field names using dot notation (which the regex might return)
+ // Keeping the dot notation references and using the helper functions simplifies the code here
+ $settings_data = Arrays::create($element['settings']);
+
+ // Bail out if we don't find a valid field name OR if the data is non-existent
+ if (empty($field) || !$settings_data->has($field)) {
+ return $element;
+ }
//=== Find the field and update the value according to field pattern above
if (!empty($id) && !empty($subfield)) { // Repeater item (field name has both ID and subfield present)
protected function has_changed($old_value, $new_value) {
- if ($old_value === $new_value) {
+ // Bail out if no change OR if old_value is an array -- it's expected to be a string
+ // NOTE: this shouldn't normally occur but it's possible if widget data structures have been updated and the
+ // spreadsheet still has a reference to the old name / value (Elementor won't delete previously saved data)
+ if ($old_value === $new_value || is_array($old_value)) {
return false;
}
// Log the changes
$this->updated_content[] = [
- 'old' => $old_value,
- 'new' => $new_value,
+ 'old' => (string)$old_value,
+ 'new' => (string)$new_value,
];
return true;