Create a custom block with details from the database containing information about user preferences.
Objectives and Prerequisites
You will need the following knowledge and skills. If you need a review, check out the Resources section at the bottom of this page.
- Define a custom block.
- Display and position a custom block.
Tasks
Define a custom block which retrieves a random entry from the user's movie preferences table created earlier.
Display the username and title of their favorite film.
Position the block in the left-hand sidebar.
Summary
- Blocks can be created programmatically.
- There are many rules to govern the visibility of blocks.
Resources
- API Documentation: Block hooks (api.drupal.org)