Skip to content

Instantly share code, notes, and snippets.

@Sam152
Sam152 / gist:3d51d51d78cdf07d4033
Last active August 29, 2015 14:27
Replicate Snippet for fleshing out brochure website menus
<?php
$main_menu_links = menu_load_links('main-menu');
foreach ($main_menu_links as $menu_item) {
if ($menu_item['link_path'] == 'node/1' && $menu_item['link_title'] !== 'Home') {
$new_node = node_load(replicate_entity_by_id('node', 1));
$new_node->title = $menu_item['link_title'];
$menu_item['link_path'] = 'node/' . $new_node->nid;
menu_link_save($menu_item);
node_save($new_node);
}
<?php
namespace Drupal\local_testing;
trait LocalTestingTrait {
/**
* Screenshot.
*/
public function takeScreenshot() {
#!/bin/bash
DIRS="./app/modules/custom/ ./app/themes/custom/"
for i in $(seq 0 4); do
echo "Looking for @expire $(date -d "-$i month" "+%b %Y")."
grep -rni "@expire $(date -d "-$i month" "+%b %Y")" $DIRS && exit 1
done
exit 0