Follow up for #1831530: Entity translation UI in core (part 2)

Problem/Motivation

@sun and @catch concern about the notice confusing the site administrator.
And, @plach

we don't want the page response to break just because an entity is not translatable when it should be.

Proposed resolution

Use a watchdog error instead of

+++ b/core/modules/translation_entity/translation_entity.installundefined
@@ -6,6 +6,33 @@
 /**
+ * Implements hook_requirements().
+ */
+function translation_entity_requirements($phase) {
+  $requirements = array();
+  $t = get_t();
+
+  if ($phase == 'runtime') {
+    $entity_types = translation_entity_types_translatable();
+    foreach (entity_get_info() as $entity_type => $info) {
+      if (translation_entity_enabled($entity_type)) {
+        if (!isset($entity_types[$entity_type])) {
+          $label = isset($info['label']) ? $info['label'] : $entity_type;
+          $t_args = array('@entity_type' => $label);
+          $requirements['translation_entity_' . $entity_type] = array(
+            'title' => $t('@entity_type translation', $t_args),
+            'value' => $t('The entities of type @entity_type do not define a valid base path: it will not be possible to translate them.', $t_args),
+            'severity' => REQUIREMENT_WARNING,
+          );
+        }
+      }
+    }
+  }
+
+  return $requirements;
+}

Remaining tasks

Take out the notice and add the watchdog.

User interface changes

No UI changes.

API changes

No API change.

Original mention

in #1831530-34: Entity translation UI in core (part 2)

better with a watchdog error. We don't want the page response to break just because an entity is not translatable when it should be.

Comments

plach’s picture

Status: Active » Closed (duplicate)
yesct’s picture

:)