gitflow | git |
---|---|
git flow init |
git init |
git commit --allow-empty -m "Initial commit" |
|
git checkout -b develop master |
This file contains 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
use Drupal\migrate\Plugin\MigrationInterface; | |
use Drupal\migrate\Plugin\MigrateSourceInterface; | |
use Drupal\migrate\Row; | |
/** | |
* Implements hook_migrate_prepare_row(). | |
*/ | |
function YOUR_MODULE_migrate_prepare_row(Row $row, MigrateSourceInterface $source, MigrationInterface $migration) { | |
switch ($migration->id()) { | |
case 'config_name': |
This file contains 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 | |
namespace Drupal\migrate_custom\Plugin\migrate\source; | |
use Drupal\Core\Database\Query\Condition; | |
use Drupal\migrate\Row; | |
use Drupal\migrate_drupal\Plugin\migrate\source\d7\FieldableEntity; | |
/** | |
* Drupal 7 file source from database. |
This file contains 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 | |
// Import arbitrary config from a variable. | |
$config = \Drupal::service('config.factory')->getEditable('filter.format.basic_html'); | |
$config->setData($data)->save(); | |
// Or, re-import the default config for a module or profile, etc. | |
\Drupal::service('config.installer')->installDefaultConfig('module', 'my_custom_module'); | |
// Or, import YAML config an arbitrary directory. |
This file contains 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 | |
namespace Drupal\my_module\Services; | |
use Drupal\Core\Config\ConfigFactory; | |
/** | |
* Class MyService. | |
* | |
* @package Drupal\my_module\Services |
This file contains 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 | |
use Drupal\node\Entity\Node; | |
/** | |
* Before attaching a term(s) to a term reference field, | |
* Must know: | |
* - field_example_name: the full name of the term reference field | |
* - tid: the term ID(s) to attach | |
* | |
* Keep in mind that this example uses Node::load() |
This file contains 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
drush eval "var_dump(Drupal\Component\Utility\Crypt::randomBytesBase64(55))" |
This file contains 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 | |
/** | |
* Create media entities from existing file fields. | |
* | |
* @link https://chromatichq.com/blog/migrating-drupal-file-fields-media-entities-without-migrate-module | |
*/ | |
function MODULENAME_update_8001() { | |
// Nodes types that will get media migrated. | |
$node_types = ['article','event','page','session','sponsor']; | |
// Map old file fields => new media fields. |
This file contains 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
l( | |
t('<span></span>Link Title'), | |
'link_path', | |
array( | |
'attributes' => array( | |
'class' => array('menu-link'), | |
'id' =>'faq-page', | |
), | |
'html' => TRUE, | |
), |
This file contains 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 | |
use Drupal\DrupalExtension\Context\DrupalContext, | |
Drupal\DrupalExtension\Event\EntityEvent, | |
Drupal\Component\Utility\Random; | |
use Behat\Behat\Context\BehatContext, | |
Behat\Behat\Context\Step, | |
Behat\Behat\Context\Step\Given, | |
Behat\Gherkin\Node\PyStringNode, |
NewerOlder