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