By editor, 30 September, 2016 Alter a view. Edit view result programmatically Tags Drupal 8 Code Views Drupal 9 Example : Change title
By Anonymous (not verified), 10 June, 2016 Database Basic Examples (Select, Merge, Insert ...) Tags Drupal 8 Code Database Drupal 9 Select: $con = \Drupal\Core\Database\Database::getConnection(); $query = $con->select('table_name', 't') ->fields('t', ['field_1', 'field_2']);
By editor, 15 January, 2016 Create a Form with Drupal 8 using Form API Tags Drupal 8 Code Module Form Drupal 9 Step 1: Create a module. (Example)
By editor, 23 December, 2015 Page Redirection on Drupal 8 / 9 Tags Drupal 8 Code Drupal 9 Example 1. Redirect to the front page: return new \Symfony\Component\HttpFoundation\RedirectResponse(\Drupal::url('<front>')); Example 2. Redirect to a route path (user page):
By editor, 16 December, 2015 Get a Image file path (src) on Drupal 8/9 Tags Drupal 8 Code Images Drupal 9 Get the image file src (url) $fid = 1;//The file ID $file = \Drupal\file\Entity\File::load($fid); $path = $file->getFileUri();
By editor, 10 December, 2015 Set the page title programmatically in Drupal 9 Tags Drupal 8 Code Drupal 9 Change on a form or controller Just set ['#title'] element. Form Example : $form['#title'] = "The title";
By editor, 5 December, 2015 Create a custom permission in Drupal 8 Tags Drupal 8 Code Permission Drupal 9 Example with a module 'mymodule' Step 1. Create if not exist yet, mymodule.permissions.yml (root of mymodule) Add your new permission like:
By editor, 18 November, 2015 Add CSS stylesheets to a module (CKEditor) Tags Drupal 8 Theming Code Drupal 9 There are several ways to do that.