Problem/Motivation

Shortcode Gmap is still a Drupal 7 module: it ships a legacy shortcode_gmap.info file (not .info.yml) with core = 7.x, and its .module file implements the removed procedural hook_shortcode_info() API, calling D7-only helpers such as theme(), shortcode_attrs(), shortcode_bool(), and $GLOBALS['language'].

The Shortcode module it depends on has since been rewritten around a PHP attribute-based plugin system (#[Shortcode(...)] on classes extending ShortcodeBase) and currently declares core_version_requirement: ^11.1 || ^12. Shortcode Gmap needs a full port to that architecture so it can run on Drupal 11.1+/12 alongside the current Shortcode API.

Steps to reproduce

Not applicable — this is a compatibility port, not a bug report. Attempting to enable shortcode_gmap on a Drupal 11/12 site fails outright: the module has no .info.yml, so Drupal never discovers it, and even if renamed, hook_shortcode_info() is no longer invoked by the current Shortcode module.

Proposed resolution

  • Add shortcode_gmap.info.yml with core_version_requirement: ^11.1 || ^12 and a dependency on the current Shortcode API (shortcode:shortcode (>=3.0) or equivalent), replacing the legacy .info file.
  • Replace shortcode_gmap_shortcode_info() with a GmapShortcode plugin under src/Plugin/Shortcode/, tagged with #[Shortcode(id: 'gmap', title: ..., description: ...)] and extending ShortcodeBase, following the pattern in shortcode_basic_tags/src/Plugin/Shortcode/ImageShortcode.php.
  • Move attribute parsing/defaults (include_map, include_link, width, height, address, zoom, information_bubble, link_text, address_text, map_type, langcode, url_suffix) into process(), using $this->getAttributes() instead of the removed shortcode_attrs()/shortcode_bool().
  • Replace $GLOBALS['language']->language with the injected language manager (current interface language).
  • Convert hook_theme() + theme_shortcode_gmap() into a class-based hook (#[Hook('theme')], per ShortcodeBasicTagsHooks::theme()) declaring a shortcode_gmap theme hook, and move the markup into a Twig template, dropping the manually concatenated HTML string.
  • Implement tips() on the plugin instead of a standalone tips callback.
  • Update the map embed markup as needed (the D7 version already used the modern maps.google.com/maps?...&output=embed iframe URL, so this likely carries over largely unchanged).

Remaining tasks

  • Write shortcode_gmap.info.yml.
  • Implement GmapShortcode plugin (process(), tips()).
  • Add class-based hook for hook_theme() and a Twig template for the map/link/address markup.
  • Remove the legacy .info and procedural .module code.
  • Add automated tests (Kernel or ExistingSite, per project convention).
  • Run phpcs/phpstan against Drupal coding standards; verify no deprecated API usage for Drupal 12.
  • Update README/module description if needed.

User interface changes

None expected — the rendered map/link/address output should remain functionally equivalent to the current shortcode output.

API changes

The gmap shortcode is redefined as a plugin class (Drupal\shortcode_gmap\Plugin\Shortcode\GmapShortcode) instead of a procedural hook_shortcode_info() implementation. Any code relying on the old D7 function names (shortcode_gmap_shortcode_gmap(), theme_shortcode_gmap()) will need to be updated; there is no BC layer since the D7 API itself is gone from Drupal 11/12.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

denes.szabo created an issue. See original summary.

denes.szabo’s picture

Status: Active » Fixed

Done. 3.0.0 released.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

denes.szabo’s picture

Assigned: denes.szabo » Unassigned
Status: Fixed » Closed (fixed)