Commit 06a10f83 authored by pashupathi nath gajawada's avatar pashupathi nath gajawada Committed by amateescu

Issue #2704219 by GPN: Removed deprecated method render and entityManager from code base

parent aa476d25
......@@ -86,7 +86,7 @@ abstract class XmlSitemapTestBase extends WebTestBase {
$this->state = \Drupal::state();
$this->config = \Drupal::configFactory()->get('xmlsitemap.settings');
$this->moduleHandler = \Drupal::moduleHandler();
$this->entityManager = \Drupal::entityManager();
$this->entityManager = \Drupal::entityTypeManager();
$this->languageManager = \Drupal::languageManager();
$this->linkStorage = \Drupal::service('xmlsitemap.link_storage');
}
......
......@@ -30,7 +30,7 @@ function xmlsitemap_requirements($phase) {
'severity' => REQUIREMENT_ERROR,
'description' => $t("The XML sitemap module requires you to enable the PHP extensions in the following list (see the <a href=\"@xmlsitemap_requirements\">module's system requirements page</a> for more information):", array(
'@xmlsitemap_requirements' => 'http://drupal.org/documentation/modules/xmlsitemap/requirements',
)) . drupal_render($items),
)) . \Drupal::service('renderer')->render($items),
);
}
......@@ -67,7 +67,7 @@ function xmlsitemap_requirements($phase) {
$items = array('#type' => 'item_list', 'items' => array_keys($directories));
$requirements['xmlsitemap_directory']['value'] = $t('Not found or not writable');
$requirements['xmlsitemap_directory']['severity'] = REQUIREMENT_ERROR;
$requirements['xmlsitemap_directory']['description'] = $t('The following directories were not found or are not writable by the server. See <a href="@docpage">@docpage</a> for more information. @directories', array('@directories' => drupal_render($items), '@docpage' => 'http://drupal.org/node/34025'));
$requirements['xmlsitemap_directory']['description'] = $t('The following directories were not found or are not writable by the server. See <a href="@docpage">@docpage</a> for more information. @directories', array('@directories' => \Drupal::service('renderer')->render($items), '@docpage' => 'http://drupal.org/node/34025'));
}
}
$sitemaps = xmlsitemap_sitemap_load_multiple();
......@@ -298,7 +298,7 @@ function xmlsitemap_install() {
\Drupal::state()->setMultiple($state_variables);
\Drupal::state()->set('xmlsitemap_base_url', Url::fromRoute('<front>', [], array('absolute' => TRUE))->toString());
$context = xmlsitemap_get_current_context();
$sitemap = \Drupal::entityManager()->getStorage('xmlsitemap')->create(array(
$sitemap = \Drupal::entityTypeManager()->getStorage('xmlsitemap')->create(array(
'id' => xmlsitemap_sitemap_get_context_hash($context),
));
$sitemap->context = xmlsitemap_get_current_context();
......@@ -328,8 +328,8 @@ function xmlsitemap_uninstall() {
// Remove the file cache directory.
xmlsitemap_clear_directory(NULL, TRUE);
$entities = \Drupal::entityManager()->getDefinitions();
$bundles = \Drupal::entityManager()->getAllBundleInfo();
$entities = \Drupal::entityTypeManager()->getDefinitions();
$bundles = \Drupal::entityTypeManager()->getAllBundleInfo();
$state_variables = array();
foreach ($entities as $entity_id => $entity) {
......
......@@ -209,7 +209,7 @@ function xmlsitemap_modules_uninstalled(array $modules) {
* Implements hook_robotstxt().
*/
function xmlsitemap_robotstxt() {
$sitemap_storage = \Drupal::entityManager()->getStorage('xmlsitemap');
$sitemap_storage = \Drupal::entityTypeManager()->getStorage('xmlsitemap');
if ($sitemap = $sitemap_storage->loadByContext()) {
$uri = xmlsitemap_sitemap_uri($sitemap);
$robotstxt[] = 'Sitemap: ' . Url::fromUri($uri['path'], $uri['options'])->toString();
......@@ -317,7 +317,7 @@ function xmlsitemap_sitemap_load_multiple($smids = array(), array $conditions =
else {
$conditions['smid'] = NULL;
}
$storage = Drupal::entityManager()->getStorage('xmlsitemap');
$storage = Drupal::entityTypeManager()->getStorage('xmlsitemap');
$sitemaps = $storage->loadMultiple($conditions['smid']);
if (count($sitemaps) <= 0) {
......@@ -622,21 +622,21 @@ function xmlsitemap_get_link_info($type = NULL, $reset = FALSE) {
$link_info = $cache->data;
}
else {
\Drupal::entityManager()->clearCachedDefinitions();
\Drupal::entityTypeManager()->clearCachedDefinitions();
$link_info = array();
$entity_types = \Drupal::entityManager()->getDefinitions();
$entity_types = \Drupal::entityTypeManager()->getDefinitions();
foreach ($entity_types as $key => $entity_type) {
$link_info[$key] = array(
'label' => $entity_type->getLabel(),
'type' => $entity_type->id(),
'base table' => $entity_type->getBaseTable(),
'bundles' => \Drupal::entityManager()->getBundleInfo($entity_type->id()),
'bundles' => \Drupal::entityTypeManager()->getBundleInfo($entity_type->id()),
);
$uri_callback = $entity_type->getUriCallback();
if (empty($uri_callback) || !isset($entity_type->xmlsitemap)) {
// Remove any non URL-able or XML sitemap un-supported entites.
}
foreach (\Drupal::entityManager()->getBundleInfo($entity_type->id()) as $bundle_key => $bundle) {
foreach (\Drupal::entityTypeManager()->getBundleInfo($entity_type->id()) as $bundle_key => $bundle) {
if (!isset($bundle['xmlsitemap'])) {
// Remove any un-supported entity bundles.
}
......@@ -1548,8 +1548,8 @@ function xmlsitemap_form_alter(array &$form, FormStateInterface $form_state, $fo
* Implements hook_xmlsitemap_index_links().
*/
function xmlsitemap_xmlsitemap_index_links($limit) {
$entity_types = \Drupal::entityManager()->getDefinitions();
$bundles = \Drupal::entityManager()->getAllBundleInfo();
$entity_types = \Drupal::entityTypeManager()->getDefinitions();
$bundles = \Drupal::entityTypeManager()->getAllBundleInfo();
foreach ($entity_types as $entity_type_id => $entity_type) {
$entity_bundles = array();
foreach ($bundles[$entity_type_id] as $bundle => $bundle_info) {
......@@ -1562,7 +1562,7 @@ function xmlsitemap_xmlsitemap_index_links($limit) {
continue;
}
try {
$query = \Drupal::entityManager()->getStorage($entity_type_id)->getQuery();
$query = \Drupal::entityTypeManager()->getStorage($entity_type_id)->getQuery();
$query->range(0, $limit);
if ($entity_type->get('type')) {
$query->condition('type', $entity_bundles, 'IN');
......@@ -2373,7 +2373,7 @@ function _xmlsitemap_regenerate_before() {
*/
function xmlsitemap_regenerate_batch(array $smids = array()) {
if (empty($smids)) {
$sitemaps = \Drupal::entityManager()->getStorage('xmlsitemap')->loadMultiple();
$sitemaps = \Drupal::entityTypeManager()->getStorage('xmlsitemap')->loadMultiple();
foreach ($sitemaps as $sitemap) {
$smids[] = $sitemap->id();
}
......
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