diff --git a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php index f3562da..69a640a 100644 --- a/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php +++ b/core/modules/comment/lib/Drupal/comment/Controller/AdminController.php @@ -7,6 +7,7 @@ namespace Drupal\comment\Controller; +use Drupal\Component\Utility\String; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Entity\EntityManager; use Drupal\Core\Extension\ModuleHandler; @@ -99,8 +100,7 @@ public function overviewBundles() { $header['operations'] = t('Operations'); } - // @todo Remove when entity_get_bundles() is a method on the entity manager. - $entity_bundles = entity_get_bundles(); + $entity_bundles = $this->entityManager->getAllBundleInfo(); $entity_types = $this->entityManager->getDefinitions(); $rows = array(); @@ -114,11 +114,11 @@ public function overviewBundles() { $row = array( 'class' => $field_info->get('locked') ? array('field-disabled') : array(''), ); - $row['data']['field_name']['data'] = $field_info->get('locked') ? t('@field_name (Locked)', array('@field_name' => $field_name)) : check_plain($field_name); + $row['data']['field_name']['data'] = $field_info->get('locked') ? t('@field_name (Locked)', array('@field_name' => $field_name)) : String::checkPlain($field_name); $row['data']['usage']['data'] = array( '#theme' => 'item_list', - '#title' => check_plain($entity_types[$entity_type]['label']), + '#title' => String::checkPlain($entity_types[$entity_type]['label']), '#items' => array(), ); foreach ($field_info_map['bundles'] as $bundle) { @@ -177,19 +177,18 @@ public function overviewBundles() { * combinations on which the comment field is in use. */ public function bundleInfo($field_name) { - // @todo Remove when entity_get_bundles() is a method on the entity manager. - $entity_bundles = entity_get_bundles(); + $entity_bundles = $this->entityManager->getAllBundleInfo(); $entity_types = $this->entityManager->getDefinitions(); // Add a link to manage entity fields if the Field UI module is enabled. $field_ui_enabled = $this->moduleHandler->moduleExists('field_ui'); // @todo Provide dynamic routing to get entity type and field name. - list($entity_type, $field) = explode('_', $field_name); + list($entity_type, $field) = explode('__', $field_name); $field_info = $this->fieldInfo->getField($entity_type, $field); // @todo Decide on better UX http://drupal.org/node/1901110 $build['usage'] = array( '#theme' => 'item_list', - '#title' => check_plain($entity_types[$entity_type]['label']), + '#title' => String::checkPlain($entity_types[$entity_type]['label']), '#items' => array(), ); // Loop over all of the entity types to which this comment field is @@ -205,7 +204,7 @@ public function bundleInfo($field_name) { else { // Field UI is disabled so fallback to a list of bundle labels // instead of links to configure fields. - $build['usage']['#items'][] = check_plain($entity_bundles[$entity_type][$bundle]['label']); + $build['usage']['#items'][] = String::checkPlain($entity_bundles[$entity_type][$bundle]['label']); } } } diff --git a/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php b/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php index 7b6ff62..f34272a 100644 --- a/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php +++ b/core/modules/comment/lib/Drupal/comment/Controller/CommentController.php @@ -9,7 +9,8 @@ use Drupal\comment\CommentInterface; use Drupal\comment\CommentManager; -use Drupal\comment\Entity\Comment; +use Drupal\field\FieldInfo; +use Drupal\node\NodeInterface; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; use Drupal\Core\Routing\UrlGeneratorInterface; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -18,8 +19,6 @@ use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\HttpKernelInterface; -use Drupal\field\FieldInfo; -use Drupal\node\NodeInterface; /** * Controller for the comment entity. diff --git a/core/modules/comment/lib/Drupal/comment/Plugin/field/field_type/CommentItem.php b/core/modules/comment/lib/Drupal/comment/Plugin/field/field_type/CommentItem.php index 0a16569..9cc6aea 100644 --- a/core/modules/comment/lib/Drupal/comment/Plugin/field/field_type/CommentItem.php +++ b/core/modules/comment/lib/Drupal/comment/Plugin/field/field_type/CommentItem.php @@ -91,7 +91,7 @@ public function instanceSettingsForm(array $form, array &$form_state) { '#collapsible' => TRUE, '#collapsed' => FALSE, '#bundle' => "{$entity_type}__{$field_name}", - '#process' => array(array(get_class($this), '_comment_field_instance_settings_form_process')), + '#process' => array(array(get_class($this), 'processSettingsElement')), '#attributes' => array( 'class' => array('comment-instance-settings-form'), ), @@ -120,7 +120,7 @@ public function instanceSettingsForm(array $form, array &$form_state) { COMMENT_ANONYMOUS_MAY_CONTACT => t('Anonymous posters may leave their contact information'), COMMENT_ANONYMOUS_MUST_CONTACT => t('Anonymous posters must leave their contact information'), ), - '#access' => user_access('post comments', drupal_anonymous_user()), + '#access' => drupal_anonymous_user()->hasPermission('post comments'), ); $element['comment']['subject'] = array( '#type' => 'checkbox', @@ -169,7 +169,7 @@ public function isEmpty() { * Attaches the required translation entity handlers for the instance which * correlates one to one with the comment bundle. */ - public static function _comment_field_instance_settings_form_process($element) { + public static function processSettingsElement($element) { // Settings should not be stored as nested. $parents = $element['#parents']; array_pop($parents);