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
| Before we get started, let’s install XCode Command Line Tools on your system. | |
| $ xcode-select --install | |
| Homebrew Installation | |
| Homebrew is an excellent package manager for macOS. Homebrew installs the stuff you need that Apple (or your Linux system) didn’t; let's install it. | |
| $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | |
| Homebrew can self-diagnose and check your system for potential problems. Let's see if everything is working the way it should. |
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
| // Place your settings in this file to overwrite the default settings | |
| { | |
| "editor.tabSize": 2, | |
| "editor.fontSize": 14, | |
| "editor.scrollBeyondLastLine": false, | |
| "editor.renderWhitespace": "boundary", | |
| "files.trimTrailingWhitespace": true, | |
| "workbench.activityBar.visible": false, | |
| "editor.minimap.enabled": true, | |
| "editor.minimap.renderCharacters": false, |
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
| // Overwrite settings by placing them into your settings file. | |
| // See http://go.microsoft.com/fwlink/?LinkId=808995 for the most commonly used settings. | |
| { | |
| // Editor | |
| // Controls the font family. | |
| "editor.fontFamily": "Fira Code", | |
| // Enables font ligatures |
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
| $('.modal form').on('form-pre-serialize', function(event, form, options, veto){ | |
| $(form).validate(); | |
| if(!$(form).valid()) | |
| { | |
| veto.veto = true; | |
| } | |
| }) |
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
| // To create a new comment entity, we'll need `use` (import) the Comment class. | |
| use Drupal\comment\Entity\Comment; | |
| // The function name doesn't matter. Just put the the function body where you need it. | |
| function my_modules_function_or_method() { | |
| // First, we need to create an array of field values for the comment. | |
| $values = [ | |
| // These values are for the entity that you're creating the comment for, not the comment itself. |
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
| <?php | |
| // Programmatically create and translate taxonomy terms Drupal 8. | |
| use Drupal\taxonomy\Entity\Term; | |
| $term = Term::create([ | |
| 'vid' => 'sport_activity', | |
| 'langcode' => 'en', | |
| 'name' => 'My tag', | |
| 'description' => [ |
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
| <?php | |
| // Programmatically create node with image fields Drupal 8. | |
| use Drupal\file\Entity\File; | |
| use Drupal\node\Entity\Node; | |
| $file = File::create([ | |
| 'uid' => 1, | |
| 'uri' => 'public://page/logo.png', | |
| 'status' => 1, | |
| ]); |
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
| <?php | |
| // Programmatically create and translate nodes Drupal 8. | |
| use Drupal\node\Entity\Node; | |
| $node = Node::create([ | |
| // The node entity bundle. | |
| 'type' => 'article', | |
| 'langcode' => 'en', | |
| 'created' => REQUEST_TIME, |
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
| <?php | |
| // Programmatically create and translate menu links Drupal 8. | |
| use Drupal\menu_link_content\Entity\MenuLinkContent; | |
| $menu_item = MenuLinkContent::create([ | |
| 'bundle' => 'menu_link_content', | |
| 'langcode' => 'en', | |
| 'title' => 'My menu link', | |
| 'description' => 'My description.', | |
| 'menu_name' => 'main', |
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
| <?php | |
| // Programmatically create files in Drupal 8. | |
| use Drupal\file\Entity\File; | |
| $file = File::create([ | |
| 'uid' => 1, | |
| 'filename' => 'logo.svg', | |
| 'uri' => 'public://page/logo.svg', | |
| 'status' => 1, | |
| ]); |
NewerOlder