Skip to main content

Creating a Drupal Block Programmatically and Basic MySQL Usage

  • Chapter
Drupal 8 for Absolute Beginners
  • 1256 Accesses

Abstract

This chapter shows how you can have a Drupal module do more than one thing—in this case the hello_world module creates a custom page and you will now create a custom block. Rather than create a brand-new module to create the custom block, you’ll just add code to the existing module. This chapter also explores how to construct basic queries to pull information out of Drupal’s back-end datastore, which for most Drupal installations will be a MySQL database (although hooking up other database types to Drupal is possible).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2015 James Barnett

About this chapter

Cite this chapter

Barnett, J. (2015). Creating a Drupal Block Programmatically and Basic MySQL Usage. In: Drupal 8 for Absolute Beginners. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-6467-5_11

Download citation

Publish with us

Policies and ethics