protected static function LibraryItem::buildLabel in Paragraphs 8
Builds a label for the library item.
Parameters
\Drupal\paragraphs\ParagraphInterface $paragraph: The paragraph for which the label should be generated.
Return value
string
1 call to LibraryItem::buildLabel()
- LibraryItem::createFromParagraph in modules/
paragraphs_library/ src/ Entity/ LibraryItem.php - Creates a library entity from a paragraph entity.
File
- modules/
paragraphs_library/ src/ Entity/ LibraryItem.php, line 290
Class
- LibraryItem
- Defines the LibraryItem entity.
Namespace
Drupal\paragraphs_library\EntityCode
protected static function buildLabel(ParagraphInterface $paragraph) {
$summary = $paragraph
->getSummaryItems([
'show_behavior_summary' => FALSE,
]);
$summary = Unicode::truncate(implode(', ', $summary['content']), 50);
return $paragraph
->getParagraphType()
->label() . ': ' . $summary;
}