Log in to your Managed Hosting Server via SSH
Add these two lines to .bashrc:
<? if (!empty($image)) : ?> | |
<img src="<?= image_style_url('mini',$image); ?>" alt="Profile image" /> | |
<?php endif; ?> |
<?php | |
/* Script located in the docroot for your Drupal 8 site */ | |
use Drupal\Core\DrupalKernel; | |
use Drupal\Core\Site\Settings; | |
use Symfony\Component\HttpFoundation\Request; | |
$autoloader = require_once __DIR__ . '/core/vendor/autoload.php'; | |
use GuzzleHttp\Client; |
alias drush='~/drush/drush' | |
alias php='/usr/local/bin/php5-53STABLE-CLI' | |
export DRUSH_PHP=/usr/local/bin/php5-53STABLE-CLI |
{# isAdmin? #} | |
{% if UserID == '1' %} | |
{{ kint() }} | |
{% endif %} |
{{ dump(_context|keys) }} |
/** | |
* Implements hook_theme_suggestions_HOOK_alter(). | |
*/ | |
function MYTHEME_theme_suggestions_image_formatter_alter(array &$suggestions, array $variables) { | |
$entity = $variables['item']->getEntity(); | |
$field_name = $variables['item']->getParent()->getName(); | |
$suggestions[] = 'image_formatter__' . $entity->getEntityTypeId() . '__' . $entity->bundle() . '__' . $field_name; | |
} |
<?php | |
/** | |
* Implements hook_theme_suggestions_HOOK_alter(). | |
*/ | |
function MYTHEME_theme_suggestions_block_alter(array &$suggestions, array $variables) | |
{ | |
$block = $variables['elements']; | |
$blockType = $block['#configuration']['provider']; | |
if ($blockType == "block_content") { |
<?php | |
\Drupal::theme()->getActiveTheme()->getPath(); | |
?> |
<?php | |
// Load the currently logged in user. | |
global $user; | |
// Check if the user has the 'editor' role. | |
if (in_array('editor', $user->roles)) { | |
// do fancy stuff | |
} | |
?> |