This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Get URL of single file field #} | |
{{ node.field_file.entity.uri.value }} | |
{# Get URL of multi file field #} | |
{{ node.field_file['#items'].entity.uri.value }} | |
{# Trun into link #} | |
{{ file_url(node.field_file.entity.uri.value) }} | |
{# Check if there is at least one value #} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get current user in drupal 8 | |
Description: In drupal 7 we get the current user object by defining global $user but in drupal 8 this quite different. If you want to get current user object then follow below code. | |
$current_user = \Drupal::currentUser(); | |
$uid = $current_user->id(); | |
It returns user id of current user. | |
$user_mail = $current_user->getEmail(); | |
It returns user email id. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# # Install Zsh on Sherlock | |
# Installs Zsh with Oh-My-Zsh without root privileges | |
# on Stanford's Sherlock (https://sherlock.stanford.edu) for use in tmux | |
# | |
# ## Instructions | |
# 1) bash install_zsh.sh | |
# 2) edit .zshrc (add the path to your Zsh binary to the PATH variable, etc.) | |
# 3) add `set-option -g default-shell <path to zsh>/bin/zsh` to `~/.tmux.conf` | |
# 4) also see comments for potential further notes | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' ); | |
function custom_remove_woo_checkout_fields( $fields ) { | |
// remove billing fields | |
unset($fields['billing']['billing_first_name']); | |
unset($fields['billing']['billing_last_name']); | |
unset($fields['billing']['billing_company']); | |
unset($fields['billing']['billing_address_1']); | |
unset($fields['billing']['billing_address_2']); |