Jump to content

inlupus

Members
  • Posts

    1
  • Joined

  • Last visited

inlupus's Achievements

Starter

Starter (1/6)

0

Reputation

  1. I wrote a short script which searches all language fields and call an update statement to copy the content to another language <?php include(__DIR__."/index.php"); $field_db_names = array(); foreach($wire->wire('fields')->find("type=FieldtypeTextareaLanguage|FieldtypeTextLanguage") as $key => $field) { $field_db_names[] = strtolower($field->name); } $languageMap = array( 'data' => 'data1017' ); $db = $wire->wire('database'); foreach ($field_db_names as $field) { echo "processing field ".$field."\n"; foreach ($languageMap as $from => $to) { echo "copy $from to $to \n"; $sql = sprintf("UPDATE field_%s SET %s = %s WHERE %s = '';",$field,$to,$from,$to); $db->query($sql); } } $languageMap contains the information what field is used to fetch the content. so in this example data is copied to data1017 if it is still empty (so nothing is overwritten).
×
×
  • Create New...