⚠️ Module main functionality refactoring

Created on 4 March 2023, over 1 year ago
Updated 18 March 2023, over 1 year ago

Problem/Motivation

Most like/unlike of functionality is .module file. And it does not respect Drupal standards.

Proposed resolution

Functionality should be moved to service and removed from .module file at all.

User interface changes

No.

API changes

⚠️ Big ones.

Functions are going to be deprecated in version 2.2.0 and removed in 3.0.0:

likeit_get_link();
likeit_get_count();
likeit_build_view();
likeit_build_link();
likeit_get_user_session_id();
likeit_do_like();
likeit_do_unlike();
likeit_set_cookie();
likeit_get_cookie();
likeit_get_link_action_type();
likeit_check();
likeit_remove_from_user();
likeit_remove_from_entity();

Please use \Drupal\likeit\LikeitHelper instead.

Here is a mapping:

  • likeit_get_link(); --> \Drupal\likeit\LikeitHelper::getLink();
  • likeit_get_count(); --> \Drupal\likeit\LikeitHelper::getCount();
  • likeit_build_view(); --> \Drupal\likeit\LikeitHelper::buildView();
  • likeit_build_link(); --> \Drupal\likeit\LikeitHelper::buildLink();
  • likeit_get_user_session_id(); --> Become protected in the service
  • likeit_do_like(); --> \Drupal\likeit\LikeitHelper::doLike();
  • likeit_do_unlike(); --> \Drupal\likeit\LikeitHelper::doUnlike();
  • likeit_set_cookie(); --> \Drupal\likeit\LikeitHelper::setCookie();
  • likeit_get_cookie(); --> \Drupal\likeit\LikeitHelper::getCookie();
  • likeit_get_link_action_type(); --> Become protected in the service
  • likeit_check(); --> \Drupal\likeit\LikeitHelper::statusCheck();

Data model changes

No.

📌 Task
Status

Fixed

Version

2.1

Component

Code

Created by

🇺🇦Ukraine andrew_tspkh

Live updates comments and jobs are added and updated live.
  • API change

    Changes an existing API or subsystem. Not backportable to earlier major versions, unless absolutely required to fix a critical bug.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024