Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 30 |
EntityDisplayModeController | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
72 | |
0.00% |
0 / 30 |
viewModeTypeSelection | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 15 |
|||
formModeTypeSelection | |
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 15 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\field_ui\Controller\EntityDisplayModeController. | |
*/ | |
namespace Drupal\field_ui\Controller; | |
use Drupal\Core\Controller\ControllerBase; | |
use Drupal\Core\Url; | |
/** | |
* Provides methods for entity display mode routes. | |
*/ | |
class EntityDisplayModeController extends ControllerBase { | |
/** | |
* Provides a list of eligible entity types for adding view modes. | |
* | |
* @return array | |
* A list of entity types to add a view mode for. | |
*/ | |
public function viewModeTypeSelection() { | |
$entity_types = array(); | |
foreach ($this->entityManager()->getDefinitions() as $entity_type_id => $entity_type) { | |
if ($entity_type->get('field_ui_base_route') && $entity_type->hasViewBuilderClass()) { | |
$entity_types[$entity_type_id] = array( | |
'title' => $entity_type->getLabel(), | |
'url' => Url::fromRoute('entity.entity_view_mode.add_form', array('entity_type_id' => $entity_type_id)), | |
'localized_options' => array(), | |
); | |
} | |
} | |
return array( | |
'#theme' => 'admin_block_content', | |
'#content' => $entity_types, | |
); | |
} | |
/** | |
* Provides a list of eligible entity types for adding form modes. | |
* | |
* @return array | |
* A list of entity types to add a form mode for. | |
*/ | |
public function formModeTypeSelection() { | |
$entity_types = array(); | |
foreach ($this->entityManager()->getDefinitions() as $entity_type_id => $entity_type) { | |
if ($entity_type->get('field_ui_base_route') && $entity_type->hasFormClasses()) { | |
$entity_types[$entity_type_id] = array( | |
'title' => $entity_type->getLabel(), | |
'url' => Url::fromRoute('entity.entity_form_mode.add_form', array('entity_type_id' => $entity_type_id)), | |
'localized_options' => array(), | |
); | |
} | |
} | |
return array( | |
'#theme' => 'admin_block_content', | |
'#content' => $entity_types, | |
); | |
} | |
} |