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