function _create_node in Menu block title 8
Helper function to create test nodes.
@noinspection PhpFullyQualifiedNameUsageInspection
Parameters
array $node_data: An array of data for the new node.
Throws
\Drupal\Core\Entity\EntityStorageException
1 call to _create_node()
- menu_block_title_test_install in tests/
modules/ responsive_menu_test/ menu_block_title_test.install - Implements hook_install().
File
- tests/
modules/ responsive_menu_test/ menu_block_title_test.install, line 124 - Install file for menu_block_title_test module.
Code
function _create_node(array $node_data) {
$node = Node::create([
'type' => 'page',
'title' => $node_data['title'],
'body' => [
'value' => $node_data['body'],
'format' => 'basic_html',
],
]);
$node
->save();
}