Commit cd2974de authored by Rodrigo  Aguilera's avatar Rodrigo Aguilera
Browse files

Issue #3152410: Check for langcode before using it

parent 09e936e9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -66,10 +66,10 @@ class PublishContentNode extends FieldPluginBase {
      return '';
    }

    $langcode = $values->{'node_field_data_langcode'};
    $langcode = $values->{'node_field_data_langcode'} ?? '';
    $id = $node->id();

    if ($node->isTranslatable() && isset($langcode) && $node->hasTranslation($langcode)) {
    if ($node->isTranslatable() && !empty($langcode) && $node->hasTranslation($langcode)) {
      $url = Url::fromRoute('entity.node.publish_translation', ['node' => $id, 'langcode' => $langcode]);
      $text = $node->getTranslation($langcode)->isPublished() ? $this->t('Unpublish (this translation)') : $this->t('Publish (this translation)');
    }