blog-banner

Hide "Promoted to Front Page" and "Sticky at Top of Lists" Options in Drupal

  • Drupal
  • Drupal Planet

Drupal 8 Promoted To Front Page

 

This blog describes how to hide "Promoted to front page" and "Sticky at top of lists" options from the node editing page in Drupal. When adding or editing a node, you can see "Publishing options" at bottom of the page which contains 'Published', 'Promoted to front page', and 'Sticky at top of lists' checkbox options. The below image shows you the three options:

 
   Disable promoted to front page and sticky at top of lists options
 
The "Published" option is used to publish the content. The "Promoted to front page" option is used to display content on the front page. The 'Sticky at top of lists' option is used to keep the content stuck to the top of the front page. If you don't need to show "Promoted to front page" and "Sticky at top of lists" options, then you can hide those options easily. You can hide these options by altering the form either using either hook_form_alter() or hook_form_form_id_alter().
 
Now you can't see options "Promoted to front page" and "Sticky at top of lists" while adding or editing the article. Similarly, you can hide these options for all node forms using hook_form_base_form_id_alter().
 
Where "node_form" is the base form id. Using this hook, we can alter all node forms instead of altering each node form separately. Now the options "Promoted to front page" and "Sticky at top of lists" are hidden from all the node forms.
Get awesome tech content in your inbox