#MailHog example page
MailHog is an email testing tool for developers.
It gives the developer the option to intercept and inspect the emails sent by his application.
You can download the MailHog Windows client from one of the links below.
version: '3' | |
services: | |
nginx: | |
labels: | |
- "traefik.enable=true" | |
- "traefik.http.routers.provys-transformer.rule=Host(`www.example.com`)" | |
- "traefik.http.routers.provys-transformer.tls=true" | |
networks: | |
- traefik |
/** | |
* Get taxonomy terms sorted by weight. | |
* | |
* @param int $vid | |
* The vocabulary id. | |
* | |
* @return array | |
* Returns an array of term id | name. | |
* | |
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException |
<?php | |
$d = new DateTime("2012-10-11"); | |
function unalteredFormat($date, $locale) { | |
$fmt = new IntlDateFormatter( | |
$locale, | |
IntlDateFormatter::SHORT, | |
IntlDateFormatter::NONE); | |
$fmtted = $fmt->format($date); |
<?php | |
/** | |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | |
* @author Phuong LE <[email protected]> <@> | |
* @copyright Copyright (c) 2017 Agence Soon (http://www.agence-soon.fr) | |
*/ | |
namespace MyVendor\MyModule\Observer; | |
<?php | |
$path = \Drupal::service('path.alias_manager')->getPathByAlias('/this-is-the-alias'); | |
if(preg_match('/node\/(\d+)/', $path, $matches)) { | |
$node = \Drupal\node\Entity\Node::load($matches[1]); | |
} |
<?php | |
// Import arbitrary config from a variable. | |
// Assumes $data has the data you want to import for this config. | |
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html'); | |
$config->setData($data)->save(); | |
// Or, re-import the default config for a module or profile, etc. | |
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module'); |
import requests | |
r = requests.get("http://download.thinkbroadband.com/10MB.zip", | |
cookies={'cookie1': 'working'} | |
) | |
open('10MB.zip', 'wb').write(r.content) |
#MailHog example page
MailHog is an email testing tool for developers.
It gives the developer the option to intercept and inspect the emails sent by his application.
You can download the MailHog Windows client from one of the links below.
<?php | |
// The drupal_set_message() function is being deprecated! | |
// @see https://api.drupal.org/api/drupal/core%21includes%21bootstrap.inc/function/drupal_set_message/8.5.x | |
// > Deprecated in Drupal 8.5.0 and will be removed before Drupal 9.0.0. | |
// > Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead. | |
// In some custom code. | |
\Drupal::messenger()->addMessage('Say something else'); |