Skip to content

Instantly share code, notes, and snippets.

View gagelafleur's full-sized avatar

Gage LaFleur gagelafleur

View GitHub Profile
For
* ES5
* ES6
* CoffeeScript
@gagelafleur
gagelafleur / CreateComment.php
Created July 28, 2024 12:09 — forked from fotrino/CreateComment.php
@mentions with Alpine.js, Livewire & Tributeq
<?php
namespace App\Http\Livewire;
use Livewire\Component;
use App\Models\User;
class CreateComment extends Component
{
public $mentionables;
@gagelafleur
gagelafleur / twig-cheat-sheet.md
Created November 11, 2022 18:25 — forked from AnneTee/twig-cheat-sheet.md
Drupal 8 Twig cheat sheet

D8 Twig cheat sheet

Conditionals

To check if a field has a value, check to see if the 0 array item is populated. Simply checking if content.field_name is truthy will not work since that variable will be defined even if the field is empty.

{% if content.field_name.0 %}
  {{ field_name }}
{% endif %}