$bid = 'myblock';
$block = \Drupal\block_content\Entity\BlockContent::load($bid);
$render = \Drupal::entityTypeManager()->getViewBuilder('block_content')->view($block);
$block_manager = \Drupal::service('plugin.manager.block');
<?php | |
/** | |
* Implements hook_preprocess_block(). | |
* | |
* Adds a few helpful theming classes to a bean block: | |
* The bean's view mode, bundle (bean type), and the value of an arbitrary | |
* field, 'field_image_size'. Use this for beans placed using core blocks or | |
* the Context module. | |
*/ | |
function THEME_preprocess_block(&$variables) { |
<!-- Twitter widget embedded in block. --> | |
<a class="twitter-timeline"data-dnt="true" data-tweet-limit="5" href="https://twitter.com/jessetweet" data-widget-id="479455834242445314">Tweets by @jessetweet</a> | |
<!--Twitter widget script is attached in the footer.--> | |
<?php | |
/** | |
* Override or insert javascript on the site. | |
* | |
* @param (array) $js | |
* An array of all JavaScript being presented on the page. I can't figure out why it won't show up if I attach it in the footer. |
# Use drush make to build only a single project from a make file (without needing to rebuild the whole thing). | |
drushMakeProject() { | |
drush make --contrib-destination=. --no-core --projects=$1 -y $2 | |
} | |
alias makeproject=drushMakeProject |
<?php | |
$fpp = fieldable_panels_panes_create(array('bundle' => 'freeform')); | |
$fpp->admin_title = "Placeholder FPP"; | |
$fpp->category = "Home page blocks"; | |
$fpp->title = "Placeholder FPP"; | |
$fpp->link = 0; | |
$fpp->field_freeform_html[und][0][value] = '<p>Placeholder</p>'; | |
$fpp->field_freeform_html[und][0][format] = "full_html"; | |
$fpp->description = "Placeholder FPP"; |
<?php | |
$range = 50; | |
$offset = variable_get('my_custom_profiles_update_offset', 0); | |
$query = db_select('users', 'u') | |
->fields('u', array('uid')); | |
$query->join('users_roles', 'ur', 'u.uid = ur.uid'); | |
$or = db_or(); | |
$or->condition('ur.rid', '9', '='); |
<?php | |
/** | |
* Implements hook_default_message_type(). | |
*/ | |
function mymodule_default_message_type() { | |
$items = array(); | |
$items['message_comment_on_group_post'] = entity_import('message_type', '{ | |
"name" : "message_comment_on_group_post", | |
"description" : "Message: Comment on Group Post", | |
"argument_keys" : [], |
<?php | |
/** | |
* @file aliases.drushrc.php | |
*/ | |
$aliases['drupal8'] = array( | |
'uri' => 'drupalimp.localhost', | |
'root' => '/path/to/project/drupal8', | |
); |
$('.megamenu-parent-title > a').click(function(e) { | |
// Don't follow the link. | |
e.preventDefault(); | |
e.stopPropagation(); | |
// Make top level links open/close the megamenu. | |
if ($(this).parent('li.megamenu-parent').hasClass('hover')) { | |
// This menu is already open. Close it. | |
megamenu_close(); | |
} | |
else { |
/** | |
* Revert xmlsitemap inclusion settings and regenerate sitemap. | |
*/ | |
function ase_base_update_7004() { | |
features_revert(array( | |
'ase_blog' => array('variable'), | |
'ase_core' => array('variable'), | |
'ase_press_release' => array('variable'), | |
'ase_product' => array('variable'), | |
'ase_resource' => array('variable'), |