Skip to content

Instantly share code, notes, and snippets.

@jorislucius
jorislucius / MessageForm.php
Last active September 1, 2020 13:10
Multiple files upload in a custom Drupal form programmatically | Native, clean example Drupal code | Also see https://www.lucius.digital/en/blog/multiple-files-upload-custom-drupal-form-programmatically-native-clean-example-drupal-code
<?php
namespace Drupal\ol_messages\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\Html;
use Drupal\Component\Utility\Xss;
use Drupal\file\Entity\File;
use Drupal\ol_file\Entity\OlFile;
@jorislucius
jorislucius / MessageForm.php
Last active August 28, 2020 10:21
Rich text editor in a custom Drupal form. Also see A custom Drupal form with multiple file upload. Also see https://www.lucius.digital/en/blog/rich-text-editor-custom-drupal-form-example-code-including-data-sanitization-security
<?php
namespace Drupal\ol_messages\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Component\Utility\Html;
use Drupal\ol_messages\Services\OlMessages;
use Symfony\Component\DependencyInjection\ContainerInterface;