If you need to create dynamic output on an entity when it is displayed on your Drupal site you have multiple options. One method that is easy to implement is using hook_entity_view()
Drupal is a great CMS but really isn't very powerful out of the box. To harness its power you'll need to use contrib (contributed) modules. Contributed modules are created by the community and are not part of the core Drupal download. But they can be downloaded and installed from the drupal.org website.
If you have nested menu links (sub-menus) in your Drupal menu system then sometime you may want to display any menu items that are children of the page you are currently on. This code will create a Drupal block that you can position within any of your theme's regions and it will automatically display an HTML list of sub-menu items.
By default, if you have a content type's "Display author and date information" turned on then Drupal will output something similar to the following when viewing a node: Submitted by John Smith on Sat, 11/15/2014 - 18:15. However, there may be times when you'll want to change the default output structure to, perhaps, display only the author or only the date. Or, you may want to change the display the format of the date output.
Sometime you may not want a contributed module that is installed in your Drupal site to be checked for updates. Perhaps you need to remain at a particular version for stability or compatibility reasons. Or, perhaps you've had to result to hacking the module to add your own custom code. Normally, Drupal will check all installed modules automatically, or manually, depending on your settings and, if an update is available, it will be listed on your Available Updates screen with access to quickly update the module automatically. This could be bad if you don't want your module to be updated.
When looking to achieve something in Drupal you'll often find the best solution is to put some code into a custom module. This often sounds daunting if you're not very experienced in Drupal or PHP but it's actually very simple to create a basic module to hold your custom code. Although modules often contain many files, at its most basic level, a Drupal module only needs two files to function: