You are here

protected function ContentEntityHandler::removeChannelId in Acquia Content Hub 8.2

Removes channel ID from a langcode.

Parameters

string $langcode: The langcode to be formatted.

Return value

null|string|string[] The new langcode.

1 call to ContentEntityHandler::removeChannelId()
ContentEntityHandler::onParseCdf in src/EventSubscriber/Cdf/ContentEntityHandler.php
Parses the CDF representation of Content Entities.

File

src/EventSubscriber/Cdf/ContentEntityHandler.php, line 271

Class

ContentEntityHandler
The Content entity CDF creator.

Namespace

Drupal\acquia_contenthub\EventSubscriber\Cdf

Code

protected function removeChannelId(string $langcode) {
  $pattern = '/(\\w+)_(\\d+)/i';
  $replacement = '${1}';
  return preg_replace($pattern, $replacement, $langcode);
}