Skip to main content
  • English
  • Español
  • Français

United
Nations

 

Office for Outer Space Affairs
UN-SPIDER Knowledge Portal

  • Home
  • About Us
    • What is UN-SPIDER?
    • About UNOOSA
    • Publications
    • Jobs
    • Meet the Team
    • Contact
  • Space Application
    • Satellite Technology
    • Emergency Mechanisms
    • Recovery Mechanisms
    • International Asteroid Warning Network
    • Space Mission Planning Advisory Group
    • International Space Weather Initiative
    • Space Technologies in the UN
    • User Stories
  • Links & Resources
    • Data Applications
      • Disaster Recovery
    • Data Sources
    • GIS and Remote Sensing Software
    • Online Learning Resources
    • Institutions
  • Risks & Disasters
    • Disaster Risk Management
    • Early Warning Systems
    • Emergency and Disaster Management
    • Natural Hazards
    • Sendai Framework
    • The UN and Disaster Risk Management
    • The UN and Early Warning
    • The UN and Disaster Management
  • Advisory Support
    • Advisory Missions
    • Emergency Support
    • Virtual Advisory Support
    • Recommended Practices
    • Training Activities
    • Practical Uses
  • Network
    • Regional Support Offices
    • GP-STAR
    • MHEWS
    • IWG-SEM
  • Projects
    • SPEAR
    • SEWS-D
    • EvIDENz
    • Flood GUIDE
  • News & Events
    • News
    • Events Calendar
    • UN-SPIDER Events Archive

Breadcrumb

  • Home
  • Books
  • Reenabled Caption On Main-Article-Image
  • Reenabled Caption on Main-Article-Image

Reenabled Caption on Main-Article-Image

By admin_wla | Tue, 27 Apr 2021 - 09:34

In the Drupal 7 version the caption of the main article images was handelt by two bits:

  • The function hook_preprocess_image() in the theme to add the class "caption" to the image tag
  • The module image_caption which added a jQuery-Function to do the work

The module doesn't exist for Drupal 8. The preprocess_image hook luckily still is available.

  • With adding the function in the .theme-file of our theme, it was feasable to add the class "caption" to an image set by an image-field when the images style is w225xh150.
  • The jQuery-Function was put into the themes js directory into the file "drupal8_w3css_subtheme.theme". There the function worked as in the Drupal 7 version.

Mission accomplished

Caution: when in Drupal 10 jQuery is eliminated, the script has to be rewritten.

Documentation
0
0
  • Printer-friendly version

Footer menu

  • Contact
  • Terms of Use

User account menu

  • Log in