Skip to content

Instantly share code, notes, and snippets.

@gaby-mg-snippets
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gaby-mg-snippets/c907c368aeaf10cba354 to your computer and use it in GitHub Desktop.
Save gaby-mg-snippets/c907c368aeaf10cba354 to your computer and use it in GitHub Desktop.
PHP: Drupal: DB Seeding
<?php
$pages = [
[
'title' => 'Promociones',
'path' => 'promociones',
'body' => 'Esta es la página de promociones',
],
[
'title' => 'Downloading',
'path' => 'downloading',
'body' => 'Esta es la página de descarga de archivos en abierto en
diferentes formatos',
],
[
'title' => 'iStock',
'path' => 'istock',
'body' => 'Esta es el banco de imágenes, audio y vídeo',
],
[
'title' => 'Guidelines',
'path' => 'guidelines',
'body' => 'Esta es la página de guias, colores y tipografías',
],
[
'title' => 'Data Bridge',
'path' => 'data-bridge',
'body' => 'Esta es la página de guias, colores y tipografías',
],
[
'title' => 'Book',
'path' => 'book',
'body' => 'Esta es la página de guias, colores y tipografías',
],
];
foreach ($pages as $page) {
$node = new stdClass();
$node->type = "page";
$node->title = $page['title'];
$note->language = LANGUAGE_NONE;
$node->path = array('alias' => $page['path']);
$node = node_submit($node);
node_save($node);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment