I've created a custom content entity (generated via drupal console), I can add custom fields just fine via the cms.

What I'm try to do now is change the default label from 'Name' to 'Artwork Title'.

I've tried the following, but I'm not seeing the changes.

class EntryEntityForm extends ContentEntityForm {

       * {@inheritdoc}
      public function buildForm(array $form, FormStateInterface $form_state) {
        $form = parent::buildForm($form, $form_state);

        $form['name']['widget']['#title'] = $this->t('Artwork Title');
        $form['name']['widget'][0]['#title'] = $this->t('Artwork Title');

        $entity = $this->entity;

        return $form;

Can someone please point me in the right direction?

closed as too broad by kiamlaluno Sep 13 at 11:59

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


I managed to change the label using the following:

$form['name']['widget'][0]['value']['#title'] = $this->t('Artwork Title');

Hope this helps someone else.

  • 1
    Thank you Janey! I spent 3 hours to find out where to change the label. – Henry Oct 17 '17 at 5:52

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