$host = Drupal::request()->getSchemeAndHttpHost() . Drupal::request()->getBasePath();
echo $host;
El resultado:
Con base url https://www.example.com/subsite y la página https://www.example.com/subsite/news sería:
https://www.example.com/subsite
// Para que busque el template en el módulo. | |
/** | |
* Implements hook_theme(). | |
*/ | |
function modulename_theme($existing, $type, $theme, $path) { | |
$templates_path = $path . '/templates/'; | |
return [ | |
'node__content_type' => [ | |
// El base_hook en este caso es node. |
En postman pon `"?XDEBUG_SESSION_START=PHPSTORM"` | |
http://ecapy.com/debuguear-rest-con-postman-xdebug-phpstorm/index.html |
$host = Drupal::request()->getSchemeAndHttpHost() . Drupal::request()->getBasePath();
echo $host;
El resultado:
Con base url https://www.example.com/subsite y la página https://www.example.com/subsite/news sería:
https://www.example.com/subsite
.parent { | |
position: relative; | |
} | |
.child { | |
position: absolute; | |
top: 50%; | |
transform: translateY(-50%); | |
} |
apt-get update
apt-get install nano
export TERM=xterm
nano
<?php | |
$s = preg_replace('/\}|\{/', '', $query->__toString()); | |
$a = $query->arguments(); | |
foreach ($a as $key => $val) { | |
$a[$key] = '\'' . $val . '\''; | |
} | |
$select = strtr($s, $a); |
global $user; | |
$file = new stdClass(); | |
$file->fid = NULL; | |
$file->uri = 'private://' . $filename; | |
$file->filename = $filename; | |
$file->filemime = file_get_mimetype($file->uri); | |
$file->uid = $user->uid; | |
$file->status = 0; | |
file_save($file); |
git merge --squash branch
Redirect everything to SSL (personal config on UNIX with IPv4, IPv6, SPDY, ...): http://stackoverflow.com/a/11733363/2172151
#
# Redirect all www to non-www
#
server {
// dependencies: | |
// - core/jquery | |
// - core/drupal | |
// - core/once | |
// https://www.drupal.org/docs/drupal-apis/javascript-api/javascript-api-overview | |
(function ($, Drupal, once) { | |
'use strict'; | |
Drupal.behaviors.myCustomBehavior = { |