Commit 3bf9694b authored by Michelle's avatar Michelle Committed by paulmckibben

Issue #2427509 by paulmckibben, Michelle, andrei.dincu: Installation fails on Drupal 8 beta 6

parent eb332878
......@@ -33,8 +33,8 @@ use Drupal\xmlsitemap\XmlSitemapInterface;
* "label" = "label"
* },
* links = {
* "edit-form" = "xmlsitemap.admin_edit",
* "delete-form" = "xmlsitemap.admin_delete"
* "edit-form" = "/admin/config/search/xmlsitemap/{xmlsitemap}/edit",
* "delete-form" = "/admin/config/search/xmlsitemap/{xmlsitemap}/delete"
* }
* )
*/
......
......@@ -58,6 +58,13 @@ class XmlSitemapEntitiesSettingsForm extends ConfigFormBase implements Container
);
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return ['xmlsitemap.settings'];
}
/**
* {@inheritdoc}
*/
......
......@@ -61,6 +61,13 @@ class XmlSitemapLinkBundleSettingsForm extends ConfigFormBase implements Contain
);
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return ['xmlsitemap.settings'];
}
/**
* {@inheritdoc}
*/
......
......@@ -55,6 +55,13 @@ class XmlSitemapRebuildForm extends ConfigFormBase {
return 'xmlsitemap_admin_rebuild';
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return ['xmlsitemap.settings'];
}
/**
* {@inheritdoc}
*/
......
......@@ -78,6 +78,13 @@ class XmlSitemapSettingsForm extends ConfigFormBase {
return 'xmlsitemap_admin_settings';
}
/**
* {@inheritdoc}
*/
protected function getEditableConfigNames() {
return ['xmlsitemap.settings'];
}
/**
* {@inheritdoc}
*/
......
......@@ -405,7 +405,7 @@ abstract class XmlSitemapTestBase extends WebTestBase {
if ($id = parent::verbose($verbose_message)) {
$url = file_create_url($this->originalFileDirectory . '/simpletest/verbose/' . get_class($this) . '-' . $id . '.html');
$message_url = Url::fromUri($url, array('attributes' => array('target' => '_blank')));
$this->error($this->l($message, $message_url)), 'User notice');
$this->error($this->l($message, $message_url), 'User notice');
}
}
......
......@@ -80,7 +80,7 @@ class XmlSitemapGenerator implements XmlSitemapGeneratorInterface {
* The state handler.
*/
public function __construct(ConfigFactoryInterface $config_factory, EntityManagerInterface $entity_manager, StateInterface $state, LanguageManagerInterface $language_manager) {
$this->config = $config_factory->get('xmlsitemap.settings');
$this->config = $config_factory->getEditable('xmlsitemap.settings');
$this->entityManager = $entity_manager;
$this->state = $state;
$this->languageManager = $language_manager;
......@@ -241,7 +241,7 @@ class XmlSitemapGenerator implements XmlSitemapGeneratorInterface {
);
// @todo Add a separate hook_xmlsitemap_link_url_alter() here?
$link['loc'] = empty($link['loc']) ? '<front>' : $link['loc'];
$link_url = Url::fromRoute($link['loc'], [], $link_options + $url_options);
$link_url = Url::fromRoute($link['loc'], [], $link_options + $url_options)->toString();
// Skip this link if it was a duplicate of the last one.
// @todo Figure out a way to do this before generation so we can report
......
......@@ -315,8 +315,9 @@ function xmlsitemap_install() {
function xmlsitemap_uninstall() {
// Remove config variables.
$variables = array_keys(xmlsitemap_config_variables());
$editable = \Drupal::configFactory()->getEditable('xmlsitemap.settings');
foreach ($variables as $variable) {
\Drupal::config('xmlsitemap.settings')->clear($variable);
$editable->clear($variable);
}
$variables = array_keys(xmlsitemap_state_variables());
......
xmlsitemap.add:
route_name: xmlsitemap.admin_add
route_name: entity.xmlsitemap.add_form
title: 'Add XML Sitemap'
appears_on:
- xmlsitemap.admin_search
......
xmlsitemap.add:
route_name: 'xmlsitemap.admin_add'
route_name: 'entity.xmlsitemap.add_form'
title: 'Add XmlSitemap'
appears_on:
- xmlsitemap.admin_search
- xmlsitemap.admin_search_list
xmlsitemap.edit:
route_name: 'xmlsitemap.admin_edit'
route_name: 'entity.xmlsitemap.edit_form'
title: 'Edit XmlSitemap'
appears_on:
- xmlsitemap.admin_search
- xmlsitemap.admin_search_list
xmlsitemap.delete:
route_name: 'xmlsitemap.admin_delete'
route_name: 'entity.xmlsitemap.delete_form'
title: 'Delete XmlSitemap'
appears_on:
- xmlsitemap.admin_search
......
......@@ -112,8 +112,8 @@ function xmlsitemap_help($route_name, RouteMatchInterface $route_match) {
case 'help.page.xmlsitemap':
case 'xmlsitemap.admin_settings':
case 'xmlsitemap.entities_settings':
case 'xmlsitemap.admin_edit':
case 'xmlsitemap.admin_delete':
case 'entity.xmlsitemap.edit_form':
case 'entity.xmlsitemap.delete_form':
return;
case 'xmlsitemap.admin_search':
break;
......@@ -760,9 +760,9 @@ function xmlsitemap_link_bundle_settings_save($entity, $bundle, array $settings,
}
foreach ($settings as $key => $value) {
\Drupal::config("xmlsitemap.settings.{$entity}.{$bundle}")->set($key, $value);
\Drupal::configFactory()->getEditable("xmlsitemap.settings.{$entity}.{$bundle}")->set($key, $value);
}
\Drupal::config("xmlsitemap.settings.{$entity}.{$bundle}")->save();
\Drupal::configFactory()->getEditable("xmlsitemap.settings.{$entity}.{$bundle}")->save();
foreach (\Drupal::languageManager()->getLanguages() as $lang) {
\Drupal::cache()->delete('xmlsitemap:link_info:' . $lang->getId());
......@@ -784,7 +784,7 @@ function xmlsitemap_link_bundle_rename($entity, $bundle_old, $bundle_new) {
if ($bundle_old != $bundle_new) {
if (!\Drupal::config("xmlsitemap.settings.{$entity}.{$bundle_old}")->isNew()) {
$settings = xmlsitemap_link_bundle_load($entity, $bundle_old);
\Drupal::config("xmlsitemap.settings.{$entity}.{$bundle_old}")->delete();
\Drupal::configFactory()->getEditable("xmlsitemap.settings.{$entity}.{$bundle_old}")->delete();
xmlsitemap_link_bundle_settings_save($entity, $bundle_new, $settings, FALSE);
\Drupal::service('xmlsitemap.link_storage')->updateMultiple(array('subtype' => $bundle_new), array('type' => $entity, 'subtype' => $bundle_old));
}
......@@ -807,10 +807,10 @@ function xmlsitemap_link_type_rename($entity_old, $entity_new, $bundles = NULL)
if (!strpos($key, "xmlsitemap_settings_{$entity_old}") && !strpos($key, "xmlsitemap_entity_{$entity_old}")) {
continue;
}
\Drupal::config('xmlsitemap.settings')->clear($key);
\Drupal::configFactory()->getEditable('xmlsitemap.settings')->clear($key);
if (isset($value)) {
$variable_new = str_replace('xmlsitemap_settings_' . $entity_old, 'xmlsitemap_settings_' . $entity_new, $key);
\Drupal::config('xmlsitemap.settings')->set($variable_new, $value)->save();
\Drupal::configFactory()->getEditable('xmlsitemap.settings')->set($variable_new, $value)->save();
}
}
......@@ -864,7 +864,7 @@ function xmlsitemap_link_bundle_load($entity, $bundle, $load_bundle_info = TRUE)
* If TRUE, deletes bundle links from {xmlsitemap} table.
*/
function xmlsitemap_link_bundle_delete($entity, $bundle, $delete_links = TRUE) {
\Drupal::config("xmlsitemap.settings.{$entity}.{$bundle}")->delete();
\Drupal::configFactory()->getEditable("xmlsitemap.settings.{$entity}.{$bundle}")->delete();
if ($delete_links) {
\Drupal::service('xmlsitemap.link_storage')->deleteMultiple(array('type' => $entity, 'subtype' => $bundle));
}
......@@ -940,8 +940,8 @@ function xmlsitemap_entity_bundle_rename($entity_type_id, $bundle_old, $bundle_n
/**
* Implements hook_entity_bundle_delete().
*/
function xmlsitemap_entity_bundle_delete($entity_type, $bundle, $instances) {
xmlsitemap_link_bundle_delete($entity_type, $bundle, TRUE);
function xmlsitemap_entity_bundle_delete($entity_type_id, $bundle) {
xmlsitemap_link_bundle_delete($entity_type_id, $bundle, TRUE);
}
/**
......@@ -2391,7 +2391,7 @@ function xmlsitemap_check_status() {
$messages = array();
foreach ($modules as $module) {
module_load_install($module);
$requirements = \Drupal::moduleHandler()->invoke($module, 'requirements', 'runtime');
$requirements = \Drupal::moduleHandler()->invoke($module, 'requirements', array('runtime'));
foreach ($requirements as $requirement) {
if (isset($requirement['severity']) && max(REQUIREMENT_OK, $requirement['severity'])) {
$messages[] = $requirement['description'];
......
......@@ -14,7 +14,7 @@ xmlsitemap.admin_search_list:
requirements:
_permission: 'administer xmlsitemap'
xmlsitemap.admin_add:
entity.xmlsitemap.add_form:
path: '/admin/config/search/xmlsitemap/add'
defaults:
_entity_form: 'xmlsitemap.add'
......@@ -22,7 +22,7 @@ xmlsitemap.admin_add:
requirements:
_permission: 'administer xmlsitemap'
xmlsitemap.admin_edit:
entity.xmlsitemap.edit_form:
path: '/admin/config/search/xmlsitemap/{xmlsitemap}/edit'
defaults:
_entity_form: 'xmlsitemap.edit'
......@@ -30,7 +30,7 @@ xmlsitemap.admin_edit:
requirements:
_permission: 'administer xmlsitemap'
xmlsitemap.admin_delete:
entity.xmlsitemap.delete_form:
path: '/admin/config/search/xmlsitemap/{xmlsitemap}/delete'
defaults:
_entity_form: 'xmlsitemap.delete'
......
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