https://symfony.com/doc/current/service_container.html
services:
site_update_manager.superadmin:
class: App\Updates\SiteUpdateManager
# you CAN still use autowiring: we just want to show what it looks like without
{"lastUpload":"2018-12-13T06:36:50.772Z","extensionVersion":"v3.2.3"} |
{"lastUpload":"2019-07-03T20:29:39.254Z","extensionVersion":"v3.2.9"} |
use Drupal\node\Entity\Node; | |
$render = []; | |
$entity_type_manager = \Drupal::entityTypeManager(); | |
$entity = $entity_type_manager->getStorage($entity_type)->load($entity_id); | |
$fields = [ | |
'body', | |
'field_example' | |
]; | |
if ($entity) { |
<?php | |
/** | |
* FileGenerator. | |
*/ | |
trait FileGeneratorTrait | |
{ | |
public static function generateFile() { | |
echo "generating file \n"; | |
} |
<?php | |
class DebugTest extends YourBrokenTest { | |
/** | |
* Overrides a broken test method and saves HTML at the point of failure. | |
*/ | |
public function testName() { | |
try { | |
parent::testName(); |
https://symfony.com/doc/current/service_container.html
services:
site_update_manager.superadmin:
class: App\Updates\SiteUpdateManager
# you CAN still use autowiring: we just want to show what it looks like without
The examples here contain some hard-coded IDs. These are all examples. In your real code, you should already have the node IDs, file IDs, etc. in a variable.
Load a node by NID:
$nid = 123; // example value
$node_storage = \Drupal::entityTypeManager()->getStorage('node');
$node = $node_storage->load($nid);
jQuery(document).ready(function(){ | |
jQuery('#edit-default-value-input-field-email-0-value').on('input', function(event){ | |
var constraint = new RegExp(/^\[[\w\d][\w\d_\-]*:[\w\d_\-]*\]$/); | |
if (constraint.test(event.target.value)) { | |
console.log(event.target); | |
this.setCustomValidity(''); | |
} | |
else { | |
console.log(event.target); | |
this.setCustomValidity('This is not a valid token'); |
Create file at ~/console/chain/generate-controller-form-render.yml
containing:
command:
name: 'generate:controller:form:render'
description: 'Controller + Form generator'
commands:
- command: 'generate:module'
options:
module: example
du -cks * | sort -rn | head -11 | |
# Usually set this up in my bash profile as an alias: | |
# alias ducks='du -cks * | sort -rn | head -11' | |
# Because it is fun to type ducks on the command line. :) |