Skip to content

Commit

Permalink
Use correct casing for node type label
Browse files Browse the repository at this point in the history
Fixed dpi#155
  • Loading branch information
dpi committed May 13, 2018
1 parent a22b55b commit 3358f3e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Form/EventTypeForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\rng\Form;

use Drupal\Component\Utility\Unicode;
use Drupal\Core\Entity\EntityForm;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
Expand Down Expand Up @@ -293,7 +294,7 @@ public function save(array $form, FormStateInterface $form_state) {

if ($event_type->isNew()) {
if ($this->moduleHandler->moduleExists('node') && ($form_state->getValue('entity_type') == 'node')) {
$node_type = $this->createContentType('event');
$node_type = $this->createContentType('Event');
$t_args = [
'%label' => $node_type->label(),
':url' => $node_type->toUrl()->toString(),
Expand Down Expand Up @@ -347,7 +348,7 @@ public function save(array $form, FormStateInterface $form_state) {
* @return \Drupal\node\NodeTypeInterface
* A node type entity.
*/
private function createContentType($prefix) {
protected function createContentType($prefix) {
// Generate a unique ID.
$i = 0;
$separator = '_';
Expand All @@ -358,7 +359,7 @@ private function createContentType($prefix) {
}

$node_type = NodeType::create([
'type' => $id,
'type' => Unicode::strtolower($id),
'name' => $id,
]);
$node_type->save();
Expand Down

0 comments on commit 3358f3e

Please sign in to comment.