-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add default content for completely reproducible website #2
Comments
Have to create menu links manually in a hook_install()... but other than that most things seem to be coming along nicely here. I'm doing this work alongside #3, so I can have some content to theme. |
In the previous, commit, I'm calling the following function from within /**
* Custom function to create menu links, until default_content can export them.
*
* @see https://www.drupal.org/project/default_content/issues/2885285
* @see https://www.drupal.org/project/drupal/issues/2577923
*/
function _pidramble_default_content_create_menu_links() {
$items = [
[
'uri' => 'route:<front>',
'title' => 'Home',
'weight' => 0,
],
[
'uri' => 'internal:/node/5',
'title' => 'Wiki',
'weight' => 5,
],
[
'uri' => 'internal:/node/2',
'title' => 'About',
'weight' => 10,
],
];
foreach($items as $item) {
$menu_link = MenuLinkContent::create([
'title' => $item['title'],
'link' => ['uri' => $item['uri']],
'weight' => $item['weight'],
'menu_name' => 'main',
'expanded' => TRUE,
]);
$menu_link->save();
}
} I'm trying to figure out if there's a way I can get these menu links to exist immediately following a fresh installation... |
As it turns out, the Default Content module creates a So, yay! Need to document this now. |
As the title says; basically add the default_content module, then add default nodes and a default admin user so I can have the entire site (including nodes) be reproducible inside the repository.
This may or may not be the best idea—otherwise I could create the content in a CSV or something and use Migrate to import after install...
The text was updated successfully, but these errors were encountered: