You are here

private function HierarchyManager::hierarchyParentOptionTitle in Entity Reference Hierarchy 8

Format the title of a given item to display in a pulldown.

Parameters

object $item: The title to be formatted

Return value

string The formatted title

See also

hierarchyGetParentSelector

1 call to HierarchyManager::hierarchyParentOptionTitle()
HierarchyManager::hierarchyGetParentSelector in src/HierarchyManager.php
Build a list of parent tiles to be displayed as part of a dropdown selector in hierarchyNodeParentFormItems. First we grab a list of allowed parents using the hierarchyParentOptions method. Then we format each title by iteratively calling…

File

src/HierarchyManager.php, line 463
Contains \Drupal\entity_hierarchy\HierarchyManager.

Class

HierarchyManager
Defines a hierarchy manager.

Namespace

Drupal\entity_hierarchy

Code

private function hierarchyParentOptionTitle($item) {
  return str_repeat('--', $item->depth - 1) . ' ' . Unicode::truncate($item->title, 45, TRUE, FALSE);
}