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 | |
/** | |
* Add legacy and new term name mapping for Section and Subject vocabularies | |
*/ | |
function my_migration_update_8001() { | |
$section_schema = [ | |
'description' => 'Legacy section term name to new section term name', | |
'fields' => [ | |
'legacy_id' => [ |
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 | |
/** | |
* @file | |
* Contains \Drupal\migrate\Event\MigrateEvent. | |
*/ | |
namespace Drupal\my_migration\Event; | |
use Drupal\migrate\Event\MigrateEvents; | |
use Drupal\migrate\Event\MigrateImportEvent; |
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\Core\Database\Database; | |
use Drupal\migrate\Plugin\MigrationInterface; | |
use Drupal\migrate\Row; | |
use Drupal\migrate\Plugin\MigrateSourceInterface; | |
/** | |
* Populate vocab renaming tables from our csv source file with the old name and new name - this |
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\views\ViewExecutable; | |
use Drupal\views\Plugin\views\query\QueryPluginBase; | |
/** | |
* Implementation of hook_views_query_alter | |
* @param type $view | |
* @param type $query |
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 | |
function yourthemename_form_system_theme_settings_alter(&$form, Drupal\Core\Form\FormStateInterface $form_state) { | |
// add the proper js and css files from your admin them and the color_field module | |
$form['#attached']['library'][] = 'myadmintheme/color-field-widget-box'; | |
$form['#attached']['library'][] = 'color_field/color-field-widget-box'; | |
// define the dark colors to be used in the palette | |
$default_dark_colors = array( |
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 | |
/** | |
* The alias table entries are prefixed with the actual path | |
* /node/nid | |
*/ | |
function return_node_titles_and_aliases() { | |
$results = db_query(" | |
SELECT |
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 | |
/** | |
* Implements hook_form_FORM_ID_alter(). | |
*/ | |
function capitalcamp_glue_form_user_register_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
// @todo come up with a more elegant approach here. | |
// Alter login form and add own custom submit handler. | |
$form['actions']['submit']['#submit'][] = '_capitalcamp_glue_user_register_form_submit'; | |
} |
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
(function ($, Drupal) { | |
'use strict'; | |
Drupal.behaviors.registration_form = { | |
attach: function (context) { | |
// Conditionally hide the city/state unless user chooses United States. | |
$("#edit-address-country").change(function () { | |
if ($("#edit-address-country").val() === "United States") { | |
$('.form-item-address-city').show(); | |
$('.form-item-address-state-province').show(); | |
} |
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 | |
/** | |
* Implements hook_form_FORM_ID_alter(). | |
*/ | |
function mymodule_form_user_register_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
// @todo come up with a more elegant approach here. | |
// Alter login form and add own custom submit handler. | |
$form['actions']['submit']['#submit'][] = '_mymodule_user_register_form_submit'; | |
} |
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 | |
/** | |
* Implements hook_form_FORM_ID_alter(). | |
*/ | |
function mymodule_form_webform_submission_registration_form_alter(array &$form, FormStateInterface $form_state) { | |
// Show 'Country' as first field. | |
$form['elements']['personal_information']['address']['#country__weight'] = -2; | |
// Show 'State' next, but conditionally. | |
$form['elements']['personal_information']['address']['#state_province__weight'] = -1; |
NewerOlder