How can I add a checkbox when I create a new page to decide wheter the user want to display the node title or not, as like the hook_block_configure() function ?
2 Answers
To do this you need to follow the steps,
- Edit the Page content type and add a new field "Show Content title" and add this one as checkbox, boolean.
- In time of creating a new Page content check if you want to show the title or not.
- Set the Page Content Type's "Show Content title" as hidden in Manage Display Settings page.
In your node.tpl.php you will see the following code
<h2<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
Then add some check over there,
<?php if($content['field_show_title'] == 1) : ?>
<h2<?php print $title_attributes; ?>>
<a href="<?php print $node_url; ?>"><?php print $title; ?></a>
</h2>
<?php endif; ?>
This can solve the issue.