| @@ 57-66 (lines=10) @@ | ||
| 54 | /** |
|
| 55 | * {@inheritdoc} |
|
| 56 | */ |
|
| 57 | public function loadNodeByName($title) { |
|
| 58 | $result = \Drupal::entityQuery('node') |
|
| 59 | ->condition('title', $title) |
|
| 60 | ->condition('status', NODE_PUBLISHED) |
|
| 61 | ->range(0, 1) |
|
| 62 | ->execute(); |
|
| 63 | assert($result, isNotEmpty()); |
|
| 64 | $nid = current($result); |
|
| 65 | return Node::load($nid); |
|
| 66 | } |
|
| 67 | ||
| 68 | /** |
|
| 69 | * {@inheritdoc} |
|
| @@ 116-125 (lines=10) @@ | ||
| 113 | /** |
|
| 114 | * {@inheritdoc} |
|
| 115 | */ |
|
| 116 | public function loadTaxonomyTermByName($type, $name) { |
|
| 117 | $result = \Drupal::entityQuery('taxonomy_term') |
|
| 118 | ->condition('name', $name) |
|
| 119 | ->condition('vid', $type) |
|
| 120 | ->range(0, 1) |
|
| 121 | ->execute(); |
|
| 122 | assert($result, isNotEmpty()); |
|
| 123 | $id = current($result); |
|
| 124 | return Term::load($id); |
|
| 125 | } |
|
| 126 | ||
| 127 | /** |
|
| 128 | * {@inheritdoc} |
|