diff --git a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php index c8b0e4a..3cfc34b 100644 --- a/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php +++ b/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php @@ -9,7 +9,6 @@ use Drupal\Component\Utility\String; use Drupal\Core\Database\Connection; -use Drupal\Core\Database\DatabaseExceptionWrapper; use Drupal\Core\Entity\ContentEntityTypeInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\Entity\EntityStorageException; @@ -1090,15 +1089,7 @@ protected function createSharedTableSchema(FieldStorageDefinitionInterface $stor $schema[$table_name] = $this->getSharedTableFieldSchema($storage_definition, $table_name, $column_names); if (!$only_save) { foreach ($schema[$table_name]['fields'] as $name => $specifier) { - try { - $schema_handler->addField($table_name, $name, $specifier); - } - catch (DatabaseExceptionWrapper $e) { - // @todo In some cases a "Data truncated for column" exception - // is thrown, but thing seem to work properly nonetheless. - // See https://www.drupal.org/node/2347301. - watchdog_exception('php', $e); - } + $schema_handler->addField($table_name, $name, $specifier); } if (!empty($schema[$table_name]['indexes'])) { foreach ($schema[$table_name]['indexes'] as $name => $specifier) { diff --git a/core/modules/content_translation/src/ContentTranslationHandler.php b/core/modules/content_translation/src/ContentTranslationHandler.php index 75871b4..f9f9c51 100644 --- a/core/modules/content_translation/src/ContentTranslationHandler.php +++ b/core/modules/content_translation/src/ContentTranslationHandler.php @@ -7,6 +7,7 @@ namespace Drupal\content_translation; +use Drupal\Component\Utility\String; use Drupal\Core\Access\AccessResult; use Drupal\Core\DependencyInjection\DependencySerializationTrait; use Drupal\Core\Entity\EntityInterface; @@ -378,8 +379,8 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En if ($new_translation) { $name = \Drupal::currentUser()->getUsername(); } - elseif ($metadata->getAuthor()->id()) { - $name = $metadata->getAuthor()->getUsername(); + elseif (($account = $metadata->getAuthor()) && $account->id()) { + $name = $account->getUsername(); } $form['content_translation']['name'] = array( '#type' => 'textfield', @@ -395,8 +396,8 @@ public function entityFormAlter(array &$form, FormStateInterface $form_state, En '#type' => 'textfield', '#title' => t('Authored on'), '#maxlength' => 25, - '#description' => t('Format: %time. The date format is YYYY-MM-DD and %timezone is the time zone offset from UTC. Leave blank to use the time of form submission.', array('%time' => format_date($date, 'custom', 'Y-m-d H:i:s O'), '%timezone' => format_date($date, 'custom', 'O'))), - '#default_value' => $new_translation ? '' : format_date($date, 'custom', 'Y-m-d H:i:s O'), + '#description' => t('Format: %time. The date format is YYYY-MM-DD and %timezone is the time zone offset from UTC. Leave blank to use the time of form submission.', array('%time' => format_date(REQUEST_TIME, 'custom', 'Y-m-d H:i:s O'), '%timezone' => format_date(REQUEST_TIME, 'custom', 'O'))), + '#default_value' => $new_translation || !$date ? '' : format_date($date, 'custom', 'Y-m-d H:i:s O'), ); if (isset($language_widget)) {