Skip to content

Instantly share code, notes, and snippets.

View rpayanm's full-sized avatar

Rolando rpayanm

View GitHub Profile

Por weight:

global-styling:
...
  css/styles.css { weight: -1 }
...
  js/scripts.js { scope: footer, weight: -6 }
...

Al header:

{#
https://www.drupal.org/node/1906780
Beware of dump()
If you want to see all variables, but dump() results in exhausted memory because of recursion or the like, you can loop through _context to see the all the keys in it:
#}
<ol>
{% for key, value in _context %}
<li>{{ key }}</li>
{% endfor %}
</ol>
border-left: thick solid #ff0000;
.your-item {
position: relative;
}
.your-item:after {
content: '';
height: 100%; //You can change this if you want smaller/bigger borders
width: 1px;
  1. Poner el código sin la carpeta node_modules y platforms.

  2. Actualizar ionic y cordova:

    $ sudo npm uninstall ionic cordova
    $ sudo npm install ionic cordova
    
  3. Ejecutar dentro del proyecto:

Para acceder al valor de un campo field_date:

$timestamp = $node->field_date->date->getTimestamp();

Make Strings Translatable

Placeholders

@variable

Use this style of placeholder for most use-cases. Special characters in the text will be converted to HTML entities.

t('Hello @name, welcome back!', array('@name' => $user->getDisplayName()));

Output example:

<?php
// node, block, block_content, user, view, fiel, taxonomy_term, menu, menu_link_content, migration, ...
$storage = 'block';
$service = \Drupal::service('entity_type.manager')->getStorage($storage);
// LOAD
// One entity
$entity = $service->load($id);

EntityQuery Conditions

The EntityQuery class can be loaded manually (if you know the entity type):

$query = \Drupal::service('entity_type.manager')->getStorage('node')->getQuery();

public function condition($field, $value = NULL, $operator = NULL, $langcode = NULL);

The $operator can take one of several options see core/lib/Drupal/Core/Entity/Query/QueryInterface.php::condition