$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');
| package mac | |
| import ( | |
| "context" | |
| "fmt" | |
| "log" | |
| "network-chesswork/utilities" | |
| "os" | |
| "os/signal" | |
| "sync" |
| π Morning 74 commits βββββββββββββββββββββ 38.7% | |
| π Daytime 42 commits βββββββββββββββββββββ 22.0% | |
| π Evening 11 commits βββββββββββββββββββββ 5.8% | |
| π Night 64 commits βββββββββββββββββββββ 33.5% |
| <?php | |
| // How to create horizontal tabs programmatically in Drupal 8, requires Field Group module | |
| $form = array(); | |
| $form['my_field'] = array( | |
| '#type' => 'horizontal_tabs', | |
| '#tree' => TRUE, | |
| '#prefix' => '<div id="unique-wrapper">', | |
| '#suffix' => '</div>', | |
| ); | |
| $items = array( |
| <?php | |
| namespace Drupal\mymodule\Plugin\Block; | |
| use Drupal\Core\Block\BlockBase; | |
| use Drupal\Core\Form\FormStateInterface; | |
| use Drupal\Core\Plugin\ContainerFactoryPluginInterface; | |
| use Drupal\file\Entity\File; | |
| use Drupal\file\FileUsage\FileUsageInterface; | |
| use Symfony\Component\DependencyInjection\ContainerInterface; |
| <?php | |
| /** | |
| * @file | |
| * Contains Drupal\mymodule\Plugin\Block\ImageRenderExampleBlockByURI. | |
| */ | |
| namespace Drupal\mymodule\Plugin\Block; | |
| use Drupal\Core\Block\BlockBase; |
| // Enable Devel module and go to /devel/php | |
| $nodes = \Drupal::entityQuery("node") | |
| ->condition('created', strtotime('-30 days'), '<=') | |
| ->execute(); | |
| $storage_handler = \Drupal::entityTypeManager()->getStorage("node"); | |
| // $entities = $storage_handler->loadMultiple(); // Delete ALL nodes. | |
| $entities = $storage_handler->loadMultiple($nodes); | |
| $storage_handler->delete($entities); |