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