Last active
August 29, 2015 14:13
-
-
Save gaby-mg-snippets/c907c368aeaf10cba354 to your computer and use it in GitHub Desktop.
PHP: Drupal: DB Seeding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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