Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 32 |
| MenuListBuilder | |
0.00% |
0 / 1 |
|
0.00% |
0 / 4 |
42 | |
0.00% |
0 / 32 |
| buildHeader | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 7 |
|||
| buildRow | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 7 |
|||
| getDefaultOperations | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 14 |
|||
| render | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\menu_ui\MenuListBuilder. | |
| */ | |
| namespace Drupal\menu_ui; | |
| use Drupal\Core\Config\Entity\ConfigEntityListBuilder; | |
| use Drupal\Core\Entity\EntityInterface; | |
| /** | |
| * Defines a class to build a listing of menu entities. | |
| * | |
| * @see \Drupal\system\Entity\Menu | |
| * @see menu_entity_info() | |
| */ | |
| class MenuListBuilder extends ConfigEntityListBuilder { | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function buildHeader() { | |
| $header['title'] = t('Title'); | |
| $header['description'] = array( | |
| 'data' => t('Description'), | |
| 'class' => array(RESPONSIVE_PRIORITY_MEDIUM), | |
| ); | |
| return $header + parent::buildHeader(); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function buildRow(EntityInterface $entity) { | |
| $row['title'] = array( | |
| 'data' => $entity->label(), | |
| 'class' => array('menu-label'), | |
| ); | |
| $row['description']['data'] = ['#markup' => $entity->getDescription()]; | |
| return $row + parent::buildRow($entity); | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function getDefaultOperations(EntityInterface $entity) { | |
| $operations = parent::getDefaultOperations($entity); | |
| if (isset($operations['edit'])) { | |
| $operations['edit']['title'] = t('Edit menu'); | |
| $operations['add'] = array( | |
| 'title' => t('Add link'), | |
| 'weight' => 20, | |
| 'url' => $entity->urlInfo('add-link-form'), | |
| ); | |
| } | |
| if (isset($operations['delete'])) { | |
| $operations['delete']['title'] = t('Delete menu'); | |
| } | |
| return $operations; | |
| } | |
| /** | |
| * {@inheritdoc} | |
| */ | |
| public function render() { | |
| $build = parent::render(); | |
| $build['#attached']['library'][] = "menu_ui/drupal.menu_ui.adminforms"; | |
| return $build; | |
| } | |
| } |