comparison core/modules/block_content/src/BlockContentForm.php @ 4:a9cd425dd02b

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:11:55 +0000
parents c75dbcec494b
children 12f9dff5fda9
comparison
equal deleted inserted replaced
3:307d7a7fd348 4:a9cd425dd02b
52 $block_type = $this->getBundleEntity(); 52 $block_type = $this->getBundleEntity();
53 $t_args = ['@type' => $block_type->label(), '%info' => $block->label()]; 53 $t_args = ['@type' => $block_type->label(), '%info' => $block->label()];
54 54
55 if ($insert) { 55 if ($insert) {
56 $logger->notice('@type: added %info.', $context); 56 $logger->notice('@type: added %info.', $context);
57 drupal_set_message($this->t('@type %info has been created.', $t_args)); 57 $this->messenger()->addStatus($this->t('@type %info has been created.', $t_args));
58 } 58 }
59 else { 59 else {
60 $logger->notice('@type: updated %info.', $context); 60 $logger->notice('@type: updated %info.', $context);
61 drupal_set_message($this->t('@type %info has been updated.', $t_args)); 61 $this->messenger()->addStatus($this->t('@type %info has been updated.', $t_args));
62 } 62 }
63 63
64 if ($block->id()) { 64 if ($block->id()) {
65 $form_state->setValue('id', $block->id()); 65 $form_state->setValue('id', $block->id());
66 $form_state->set('id', $block->id()); 66 $form_state->set('id', $block->id());
81 } 81 }
82 } 82 }
83 else { 83 else {
84 // In the unlikely case something went wrong on save, the block will be 84 // In the unlikely case something went wrong on save, the block will be
85 // rebuilt and block form redisplayed. 85 // rebuilt and block form redisplayed.
86 drupal_set_message($this->t('The block could not be saved.'), 'error'); 86 $this->messenger()->addError($this->t('The block could not be saved.'));
87 $form_state->setRebuild(); 87 $form_state->setRebuild();
88 } 88 }
89 } 89 }
90 90
91 } 91 }