Commit d5c96218 authored by catch's avatar catch

Issue #2141523 by effulgentsia, tim.plunkett: Comment's comment.bundle route contains unused code.

parent 9826e247
...@@ -74,11 +74,9 @@ comment.bundle_list: ...@@ -74,11 +74,9 @@ comment.bundle_list:
requirements: requirements:
_permission: 'administer comments' _permission: 'administer comments'
# This route is only used by Field UI.
comment.bundle: comment.bundle:
path: '/admin/structure/comments/manage/{bundle}' path: '/admin/structure/comments/manage/{bundle}'
defaults:
_content: 'Drupal\comment\Controller\AdminController::bundleInfo'
_title_callback: 'Drupal\comment\Controller\AdminController::bundleTitle'
requirements: requirements:
_access: 'FALSE' _access: 'FALSE'
......
...@@ -184,65 +184,6 @@ public function overviewBundles() { ...@@ -184,65 +184,6 @@ public function overviewBundles() {
return $build; return $build;
} }
/**
* Returns an overview of the entity types a comment field is attached to.
*
* @param string $commented_entity_type
* The entity type to which the comment field is attached.
* @param string $field_name
* The comment field for which the overview is to be displayed.
*
* @return array
* A renderable array containing the list of entity types and bundle
* combinations on which the comment field is in use.
*/
public function bundleInfo($commented_entity_type, $field_name) {
// Add a link to manage entity fields if the Field UI module is enabled.
$field_ui_enabled = $this->moduleHandler()->moduleExists('field_ui');
$field_info = $this->fieldInfo->getField($commented_entity_type, $field_name);
$entity_type_info = $this->entityManager()->getDefinition($commented_entity_type);
$entity_bundle_info = $this->entityManager()->getBundleInfo($commented_entity_type);
$build['usage'] = array(
'#theme' => 'item_list',
'#title' => String::checkPlain($entity_type_info->getLabel()),
'#items' => array(),
);
// Loop over all of bundles to which this comment field is attached.
foreach ($field_info->getBundles() as $bundle) {
// Add the current instance to the list of bundles.
if ($field_ui_enabled && $route_info = FieldUI::getOverviewRouteInfo($commented_entity_type, $bundle)) {
// Add a link to configure the fields on the given bundle and entity
// type combination.
$build['usage']['#items'][] = $this->l($entity_bundle_info[$bundle]['label'], $route_info['route_name'], $route_info['route_parameters']);
}
else {
// Field UI is disabled so fallback to a list of bundle labels
// instead of links to configure fields.
$build['usage']['#items'][] = String::checkPlain($entity_bundle_info[$bundle]['label']);
}
}
return $build;
}
/**
* Route title callback.
*
* @param string $commented_entity_type
* The entity type to which the comment field is attached.
* @param string $field_name
* The comment field for which the overview is to be displayed.
*
* @return string
* The human readable field name.
*/
public function bundleTitle($commented_entity_type, $field_name) {
return $this->commentManager->getFieldUIPageTitle($commented_entity_type, $field_name);
}
/** /**
* Presents an administrative comment listing. * Presents an administrative comment listing.
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment