You are here

public function EasyBreadcrumbBuilder::truncator in Easy Breadcrumb 8

Same name and namespace in other branches
  1. 2.x src/EasyBreadcrumbBuilder.php \Drupal\easy_breadcrumb\EasyBreadcrumbBuilder::truncator()

Truncate the title.

Parameters

string $title: Text/title to be truncated.

Return value

array|\Drupal\Core\StringTranslation\TranslatableMarkup|false|mixed|string|null Return truncated title.

1 call to EasyBreadcrumbBuilder::truncator()
EasyBreadcrumbBuilder::build in src/EasyBreadcrumbBuilder.php
Builds the breadcrumb.

File

src/EasyBreadcrumbBuilder.php, line 988

Class

EasyBreadcrumbBuilder
Primary implementation for the Easy Breadcrumb builder.

Namespace

Drupal\easy_breadcrumb

Code

public function truncator(string $title) {
  $title = mb_strimwidth($title, 0, $this->config
    ->get(EasyBreadcrumbConstants::TRUNCATOR_LENGTH), $this->config
    ->get(EasyBreadcrumbConstants::TRUNCATOR_DOTS) ? '...' : '', 'utf8');
  return $title;
}