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 | |
namespace Drupal\module_name\Plugin\video_embed_field\Provider; | |
use Drupal\video_embed_field\ProviderPluginBase; | |
/** | |
* @VideoEmbedProvider( | |
* id = "qumu", | |
* title = @Translation("QUMU") |
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
# These parts extend an existing module's CSS, allowing you to build on top of it. | |
# THEME.libraries.yml | |
/** | |
* In this example, we're extending the eu_cookie_compliance library. | |
* This part declares the new library you'll be creating to extend the existing | |
* CSS. | |
*/ | |
eu_cookie_compliance: | |
version: 1.x |
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 | |
use Drupal\Core\Entity\EntityTypeInterface; | |
use Drupal\link\LinkItemInterface; | |
/** | |
* Implements hook_entity_base_field_info(). | |
* In this example, you get the id of an existing entity, then add a field to it. | |
* Here, we create a link field that allows for link text, and then can be | |
* viewable on the output. |
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
/** | |
* Implements hook_form_alter(). | |
*/ | |
function HOOK_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) { | |
$formIds = [ | |
'eform-submission-guide-request-form' // Example of a $form_id. | |
]; | |
$formIds = str_replace('-', '_', $formIds); // Change the $form_id to something Drupal understands. |
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 | |
use Drupal\Core\Entity\EntityInterface; | |
function HOOK_entity_update(EntityInterface $entity) { | |
$host = 'local'; | |
if (array_key_exists('AH_SITE_ENVIRONMENT', $_ENV)) { | |
$host = $_ENV['AH_SITE_ENVIRONMENT']; | |
} | |
elseif (array_key_exists('AH_SITE_ENVIRONMENT', $_SERVER)) { |
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
/** | |
* Implements hook_preprocess_field(). | |
* @param $variables | |
*/ | |
function THEMENAME_preprocess_field(&$variables) { | |
$node = \Drupal::routeMatch()->getParameter('node'); | |
if ($node->hasField('field_links_social')) { | |
$twitter = $node->get('field_links_social')->getValue(); | |
$twitterURL = $twitter[0]["uri"]; |
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
# settings.local.php | |
require_once DRUPAL_ROOT . '/modules/contrib/devel/kint/kint/Kint.class.php'; | |
Kint::$maxLevels = 4; |
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
try { | |
// Try something ... | |
} | |
catch (\Exception $e) { | |
// Log the error message | |
\Drupal::logger('ModuleOrWhateverName')->error($e); | |
} |
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
$email = \Drupal::currentUser()->getEmail(); |
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
var gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
var shell = require('gulp-shell'); | |
gulp.task('styles', function() { | |
gulp.src('scss/**/*.scss') | |
.pipe(sass().on('error', sass.logError)) | |
.pipe(gulp.dest('css/')); | |
}); |
NewerOlder