| @@ 52-61 (lines=10) @@ | ||
| 49 | /** |
|
| 50 | * {@inheritdoc} |
|
| 51 | */ |
|
| 52 | public function loadNodeByName($title) { |
|
| 53 | $result = \Drupal::entityQuery('node') |
|
| 54 | ->condition('title', $title) |
|
| 55 | ->condition('status', NODE_PUBLISHED) |
|
| 56 | ->range(0, 1) |
|
| 57 | ->execute(); |
|
| 58 | assert($result, isNotEmpty()); |
|
| 59 | $nid = current($result); |
|
| 60 | return Node::load($nid); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * {@inheritdoc} |
|
| @@ 107-116 (lines=10) @@ | ||
| 104 | /** |
|
| 105 | * {@inheritdoc} |
|
| 106 | */ |
|
| 107 | public function loadTaxonomyTermByName($type, $name) { |
|
| 108 | $result = \Drupal::entityQuery('taxonomy_term') |
|
| 109 | ->condition('name', $name) |
|
| 110 | ->condition('vid', $type) |
|
| 111 | ->range(0, 1) |
|
| 112 | ->execute(); |
|
| 113 | assert($result, isNotEmpty()); |
|
| 114 | $id = current($result); |
|
| 115 | return Term::load($id); |
|
| 116 | } |
|
| 117 | ||
| 118 | /** |
|
| 119 | * {@inheritdoc} |
|