This is a follow up to my question in Can I change the Display Settings by modifying the database? which was answered. Basically, I could not get to the 'display authoring and date information' checkbox because of a module installed. Running the command 'drush cedit node.type.article' as given in @4k4's answer allows me to change this setting.

However, when a new content type is created, the type has display_submitted: true set meaning I have to go in and change it whenever a new content type is created, which I sometimes cannot do.

Is there a way to change the default settings so that any new content type has display_submitted: false by default?

1 Answer 1


For content or config entities you can set default values in a hook_ENTITY_TYPE_create():

use Drupal\node\Entity\NodeType;

 * Implements hook_ENTITY_TYPE_create() for 'node_type'.
function mymodule_node_type_create(NodeType $node_type) {
  $node_type->set('display_submitted', FALSE);
  • So do I still have to do this for every new content type? If not, where exactly do I use this code? Commented Nov 12, 2018 at 16:40
  • No, once this hook is implemented it is called automatically when new content types are created. Put it in the file mymodule.module of a custom module, replace mymodule with your module name.
    – 4uk4
    Commented Nov 12, 2018 at 16:59
  • That does the trick! I didn't realize I had two write a module to do this (it might be a good idea to mention that in your answer, although people more familiar with drupal than me would already know that). Commented Nov 12, 2018 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.