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