-5

I want to get the list of current modules and themes and modify them on Drupal 9, previously in Drupal 8,7 I used the following functions to get and save them but it seems they are depricated on Drupal 9.

 system_get_info(), _system_rebuild_module_data()

what is equivalent to these functions in Drupal 9 and how can get/update data about the module/themes in Drupal 9?

  • 2
    From the help center: How do I ask a good question? We’d love to help you. To improve your chances of getting an answer, here are some tips: Search, and research Have you thoroughly searched for an answer before asking your question? Sharing your research helps everyone. Tell us what you found and why it didn’t meet your needs. This demonstrates that you’ve taken the time to try to help yourself, it saves us from reiterating obvious answers, and above all, it helps you get a more specific and relevant answer!" – anonymous Apr 12 at 19:02
  • 1
    Wow Yusef, and now downvoting the answers. Really not nice. – leymannx Apr 12 at 20:51
  • 3
    I'm voting to close this question as off-topic because this information can easily be found in the documentation, for example system_get_info(). – leymannx Apr 12 at 20:56
  • @leymannx I could remember I down vote on answers. but the sound correct. I apologize for that ( maybe someone seated behind my seat ). naughty colleagues – Yuseferi Jun 25 at 12:56
0

Simply check the deprecation notice on system_get_info

Deprecated

in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal::service('extension.list.$type')->getExtensionInfo() or \Drupal::service('extension.list.$type')->getAllInstalledInfo() instead.

and the change record on _system_rebuild_module_data() and co. are replaced by services to give you all available modules and themes

// If you want to just get all extensions without rebuilding.
$module_list = \Drupal::service('extension.list.module')->getList();
| improve this answer | |
1

The change records tell you all you need to know ...

https://www.drupal.org/list-changes/drupal/published?keywords_description=system_get_info&to_branch=&version=&created_op=%3E%3D&created%5Bvalue%5D=&created%5Bmin%5D=&created%5Bmax%5D=

| improve this answer | |
  • 1
    Oh wow I didn't know of drupal.org/list-changes/drupal, thanks for that gem! I was always just googling for the functions. 😊 – leymannx Apr 12 at 20:52
  • 1
    @leymannx, there is a link on the project page drupal.org/project/drupal – 4k4 Apr 13 at 18:54
  • @4k4 – Ah I've probably never been on that page, too! Bookmarked! – leymannx Apr 13 at 21:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.