Skip to content

Instantly share code, notes, and snippets.

View sachbearbeiter's full-sized avatar
❤️

Sachbearbeiter sachbearbeiter

❤️
View GitHub Profile
@sachbearbeiter
sachbearbeiter / Blocks.md
Created April 19, 2024 10:24 — forked from davidjguru/Blocks.md
Drupal 8 programmatic solutions

Render custom blocks

$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);

Render plugin blocks

$block_manager = \Drupal::service('plugin.manager.block');
@sachbearbeiter
sachbearbeiter / html.tpl.php
Created February 10, 2019 16:21 — forked from pascalduez/html.tpl.php
Drupal 7 — Move $scripts at page bottom
<!DOCTYPE html>
<html<?php print $html_attributes; ?>>
<head>
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $head_scripts; ?>
</head>
<body<?php print $body_attributes;?>>
<?php
// Load the currently logged in user.
global $user;
// Check if the user has the 'editor' role.
if (in_array('editor', $user->roles)) {
// do fancy stuff
}
?>

Install Composer on Managed Hosting at Domainfactory

Step 1:

Log in to your Managed Hosting Server via SSH

Step 2:

Add these two lines to .bashrc:

@sachbearbeiter
sachbearbeiter / .bashrc
Last active August 29, 2015 14:14 — forked from cbeier/.bashrc
alias drush='~/drush/drush'
alias php='/usr/local/bin/php5-53STABLE-CLI'
export DRUSH_PHP=/usr/local/bin/php5-53STABLE-CLI
<?php
/* Script located in the docroot for your Drupal 8 site */
use Drupal\Core\DrupalKernel;
use Drupal\Core\Site\Settings;
use Symfony\Component\HttpFoundation\Request;
$autoloader = require_once __DIR__ . '/core/vendor/autoload.php';
use GuzzleHttp\Client;