| @@ 24-33 (lines=10) @@ | ||
| 21 | /** |
|
| 22 | * {@inheritdoc} |
|
| 23 | */ |
|
| 24 | public function convertLabelToNodeTypeId($type) { |
|
| 25 | // First suppose that the id has been passed. |
|
| 26 | if (NodeType::load($type)) { |
|
| 27 | return $type; |
|
| 28 | } |
|
| 29 | $storage = \Drupal::entityTypeManager()->getStorage('node_type'); |
|
| 30 | $result = $storage->loadByProperties(['name' => $type]); |
|
| 31 | assert($result, isNotEmpty()); |
|
| 32 | return key($result); |
|
| 33 | } |
|
| 34 | ||
| 35 | /** |
|
| 36 | * {@inheritdoc} |
|
| @@ 38-47 (lines=10) @@ | ||
| 35 | /** |
|
| 36 | * {@inheritdoc} |
|
| 37 | */ |
|
| 38 | public function convertLabelToTermTypeId($type) { |
|
| 39 | // First suppose that the id has been passed. |
|
| 40 | if (Vocabulary::load($type)) { |
|
| 41 | return $type; |
|
| 42 | } |
|
| 43 | $storage = \Drupal::entityTypeManager()->getStorage('taxonomy_vocabulary'); |
|
| 44 | $result = $storage->loadByProperties(['name' => $type]); |
|
| 45 | assert($result, isNotEmpty()); |
|
| 46 | return key($result); |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * {@inheritdoc} |
|