diff --git a/yandex_metrics.module b/yandex_metrics.module
index c151631..89a9358 100644
--- a/yandex_metrics.module
+++ b/yandex_metrics.module
@@ -47,11 +47,11 @@ function yandex_metrics_show_counter() {
$urls_equal = FALSE;
if (!empty($pages)) {
- $pages_in_lowcase = Unicode::strtolower($pages);
+ $pages_in_lowcase = mb_strtolower($pages);
- $current_path = Drupal::service('path.alias_manager')->getAliasByPath(\Drupal::service('path.current')->getPath());
+ $current_path = Drupal::service('path_alias.manager')->getAliasByPath(\Drupal::service('path.current')->getPath());
- $current_path = Unicode::strtolower($current_path);
+ $current_path = mb_strtolower($current_path);
// In D8 alias is with leading slash?
// @todo: Make sure we follow D8 standards of aliases.
diff --git a/yandex_metrics_reports/yandex_metrics_reports.install b/yandex_metrics_reports/yandex_metrics_reports.install
index 6374914..db65fd7 100644
--- a/yandex_metrics_reports/yandex_metrics_reports.install
+++ b/yandex_metrics_reports/yandex_metrics_reports.install
@@ -9,7 +9,9 @@
*/
function yandex_metrics_reports_uninstall() {
// Delete module variables and clear variables cache.
- db_delete('variable')
+ // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+ // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+ \Drupal::database()->delete('variable')
->condition('name', 'yandex_metrics_reports_%', 'LIKE')
->execute();
cache_clear_all('variables', 'cache_bootstrap');
@@ -151,7 +153,9 @@ function yandex_metrics_reports_update_7300() {
variable_del('yandex_metrics_reports_date_period');
// Remove redundant variables. Now we have only one variable for all report metadata.
- db_delete('variable')
+ // TODO: Drupal Rector Notice: Please delete the following comment after you've made any necessary changes.
+ // You will need to use `\Drupal\core\Database\Database::getConnection()` if you do not yet have access to the container here.
+ \Drupal::database()->delete('variable')
->condition('name', 'yandex_metrics_reports_%_visible', 'LIKE')
->execute();
cache_clear_all('variables', 'cache_bootstrap');
diff --git a/yandex_metrics_reports/yandex_metrics_reports.module b/yandex_metrics_reports/yandex_metrics_reports.module
index 750f2b8..c0efaf0 100644
--- a/yandex_metrics_reports/yandex_metrics_reports.module
+++ b/yandex_metrics_reports/yandex_metrics_reports.module
@@ -197,29 +197,20 @@ function yandex_metrics_reports_report($filter = 'week') {
$counter_id = yandex_metrics_reports_get_counter_for_current_site();
if (empty($counter_id)) {
- drupal_set_message(
- t("Couldn't get information about the counter from Yandex.Metrica. See more details in log.") . '
' .
- t('Also, make sure that you created the counter and authorized your site at Yandex.'),
- 'error'
- );
+ \Drupal::messenger()->addError(t("Couldn't get information about the counter from Yandex.Metrica. See more details in log.") . '
' .
+ t('Also, make sure that you created the counter and authorized your site at Yandex.'));
return '';
}
$counter_code = variable_get('yandex_metrics_counter_code', '');
if (empty($counter_code)) {
- drupal_set_message(
- t('Perhaps you have not yet placed Yandex.Metrica counter code on the site. You can do this !link.', array('!link' => l(t('here'), 'admin/config/system/yandex_metrics'))),
- 'notice'
- );
+ \Drupal::messenger()->addNotice(t('Perhaps you have not yet placed Yandex.Metrica counter code on the site. You can do this !link.', array('!link' => l(t('here'), 'admin/config/system/yandex_metrics'))));
}
$authorisation_token = yandex_services_auth_info('token');
if (empty($authorisation_token)) {
- drupal_set_message(
- t('Please make sure that your application is authorized !link.', array('!link' => l(t('here'), 'admin/config/system/yandex_services_auth'))),
- 'error'
- );
+ \Drupal::messenger()->addError(t('Please make sure that your application is authorized !link.', array('!link' => l(t('here'), 'admin/config/system/yandex_services_auth'))));
return '';
}
@@ -230,7 +221,7 @@ function yandex_metrics_reports_report($filter = 'week') {
$form = drupal_get_form('yandex_metrics_reports_filter_form');
- $output .= drupal_render($form);
+ $output .= \Drupal::service('renderer')->render($form);
$reports = yandex_metrics_reports_get_active_list();
@@ -329,10 +320,7 @@ function yandex_metrics_reports_get_counter_for_current_site() {
watchdog('yandex_metrics_reports',
'The site host does not belong to any Yandex.Metrika counter of the account. Current host: "%host". Known hosts: "%registered_hosts".',
array('%host' => $current_host, "%registered_hosts" => implode('", "', $registered_hosts) ), WATCHDOG_WARNING);
- drupal_set_message(
- t('The site host does not belong to any Yandex.Metrika counter of the account. Check your counter host and mirrors. Pay special attention to the www. prefix.'),
- 'error'
- );
+ \Drupal::messenger()->addError(t('The site host does not belong to any Yandex.Metrika counter of the account. Check your counter host and mirrors. Pay special attention to the www. prefix.'));
return FALSE;
}
@@ -435,8 +423,8 @@ function theme_yandex_metrics_reports_reports($vars) {
$rows = array();
foreach (element_children($form['reports']) as $report_name) {
$row = array(
- drupal_render($form['reports'][$report_name]['yandex_metrics_reports_' . $report_name . '_visible']),
- drupal_render($form['reports'][$report_name]['yandex_metrics_reports_' . $report_name . '_weight']),
+ \Drupal::service('renderer')->render($form['reports'][$report_name]['yandex_metrics_reports_' . $report_name . '_visible']),
+ \Drupal::service('renderer')->render($form['reports'][$report_name]['yandex_metrics_reports_' . $report_name . '_weight']),
);
$rows[] = array(
'data' => $row,