Skip to content

Commit

Permalink
Add form element for the status and make name field required (#3775)
Browse files Browse the repository at this point in the history
  • Loading branch information
LOBsTerr authored and jmolivas committed Feb 9, 2018
1 parent b596bfe commit 3f64cc1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions templates/module/src/Entity/entity-content.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,20 @@ class {{ entity_class }} extends {% if revisionable %}RevisionableContentEntityB
'weight' => -4,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
->setDisplayConfigurable('view', TRUE)
->setRequired(TRUE);

$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the {{ label }} is published.'))
{% if revisionable %}
->setRevisionable(TRUE)
{% endif %}
->setDefaultValue(TRUE);
->setDefaultValue(TRUE)
->setDisplayOptions('form', [
'type' => 'checkbox',
'weight' => -3,
]);

$fields['created'] = BaseFieldDefinition::create('created')
->setLabel(t('Created'))
Expand Down

0 comments on commit 3f64cc1

Please sign in to comment.