Skip to content

Instantly share code, notes, and snippets.

View juampynr's full-sized avatar

Juampy NR juampynr

View GitHub Profile
@juampynr
juampynr / response.xml
Created June 2, 2016 15:13
Plain XML response
<?xml version="1.0" encoding="UTF-8"?>
<response>
<nid>
<value>2</value>
</nid>
<uuid>
<value>a626d6e5-84a6-41ec-98e5-480a7c210295</value>
</uuid>
<langcode>
<value>en</value>
@juampynr
juampynr / response.xml
Created June 2, 2016 15:12
Custom XML Response
<?xml version="1.0" encoding="UTF-8"?>
<response>
<nid>
<value>2</value>
</nid>
<uuid>
<value>a626d6e5-84a6-41ec-98e5-480a7c210295</value>
</uuid>
<langcode>
<value>en</value>
@juampynr
juampynr / README.md
Created May 31, 2016 09:35
Run Drupal 8 web tests without installing Drupal
  1. Create a MySQL database.
  2. Create a user that has access to that database.
  3. Make sure that you have the PDO_MySQL PHP library (otherwise you will get an error because it is missing).
  4. Run the following script.
  5. Once tests complete, we need to stop PHP's web server.

Note: there seem to be some issues with PHP's built-in web server. Please report them here https://www.drupal.org/node/1543858.

@juampynr
juampynr / config_override.md
Last active April 27, 2016 11:16
Overriding a config variable in Drupal 8
  1. Find the form field in core. Usually I use the label or description field for this.
  2. Check which configuration object and property is used for this field.
  3. At sites/default/settings.php, uncomment the code that loads settings.local.php and create the file with the overrides. For example, here is how to set verbose logging:
$config['system.logging']['error_level'] = 'verbose';
  1. Even though you may not see the form value change as in Drupal 7 (which is unfortunate), the configuration override will work.
<JoseCarlosss> buenas a todos, a que puede ser debido que ejecuto comando de drush y funciona perfectamente y si creo un script de drush cuando ejecuto dicho script me da permiso denegado al ejecutar un comando de drush dentro del script ?
<JoseCarlosss> es decir, mismo comando en script me da permiso denegado y por consola me funciona
<leandro> JoseCarlosss: comprueba la ruta desde la q ejecutas el script y, dentro de éste, si se posiciona correctamente en el directorio adecuado donde tengas instalado el Drupal
<JoseCarlosss> ok, lo miro aunque creo que está correcto al 99% seguro
<JoseCarlosss> gracias leandro
* nesimo (~mmanzano@63.red-83-55-196.dynamicip.rima-tde.net) has joined #drupal-es
<e0ipso> plopesc te veré en la drupalcamp?
<plopesc> yep e0ipso , llego el viernes a medio día
<e0ipso> mola
<e0ipso> igual que yo
diff --git a/moment.info.yml b/moment.info.yml
index 3f3d5be..89d4431 100644
--- a/moment.info.yml
+++ b/moment.info.yml
@@ -2,6 +2,4 @@ name: Moment.js
description: 'Integrate Moment.js library into Drupal.'
package: Libraries
core: 8.x
-dependencies:
- - system_stream_wrapper
@juampynr
juampynr / run.php
Created April 6, 2016 18:29
PsySH and Vdebug
require('/usr/share/drush/vendor/psy/psysh/bin/psysh');
eval(\Psy\sh());
<?php
use Drupal\Core\Render\BubbleableMetadata;
use Drupal\node\Entity\Node;
$node = Node::load(106);
$token_service = \Drupal::service('token');
$tokens = array(
'field_sample_boolean' => '[node:field_sample_boolean]',
▾ $info = (array [2])
\
▾ $info['tokens'] = (array [19])
\
▾ $info['tokens']['node'] = (array [82])
\
▸ $info['tokens']['node']['author'] = (array [2])
|
▸ $info['tokens']['node']['body'] = (array [2])
|

This is the output when the field has a value:

juampy@Juampy/var/www/drupal8(8.0.x)$ drush scr script
string(32) "Some text Un articulo more text."

This is the output when the field does not have a value: