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
/** | |
* @file | |
* Preview behaviors. | |
*/ | |
(function ($, Drupal) { | |
Drupal.behaviors.conditional_fields = { | |
attach(context) { | |
// Hide the help text initially. |
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 | |
// https://www.drupal.org/docs/drupal-apis/form-api/conditional-form-fields#s-table-of-contents | |
/** | |
* Implements hook_field_widget_single_element_[WIDGET_TYPE]_form_alter(). | |
*/ | |
function custom_field_widget_single_element_paragraphs_form_alter(&$element, &$form_state, $context) { | |
/** @var \Drupal\field\Entity\FieldConfig $field_definition */ | |
$field_definition = $context['items']->getFieldDefinition(); | |
$paragraph_entity_reference_field_name = $field_definition->getName(); |
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
1. Creating a schema within your my-component.component.yml is mandatory for modules, but optional for themes. | |
2. Note you can force all components within your theme to require schemas by adding the following to your themename.info.yml. | |
enforce_prop_schemas: true | |
3. You can load additional styles, scripts, and dependencies using the libraryOverrides key within your component’s YML file if necessary. | |
4. The final directory structure looks something like this https://www.drupal.org/docs/develop/theming-drupal/using-single-directory-components/creating-a-single-directory-component#s-to-create-your-first-single-directory-component-follow-these-steps | |
5. Only .twig and .yml files are required others are optional | |
6. Schema follows https://json-schema.org/understanding-json-schema | |
7. Only themes can override components (modules cannot override | |
8. For a theme to override a component, use the "replaces" key within the mytheme.component.yml file. e.g. replaces: 'sdc_theme_test:my-card' | |
9. In addition, both components mu |
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
# create a folder .github/workflows and file name say build.yml | |
# create a token from Profile settings, Developer settings, Personal access token, Token(classic) | |
# create secret keys in repo settings "Secrets and variables" -> "Actions" | |
name: Build and Deploy SSG | |
on: | |
repository_dispatch: | |
types: [deploy] | |
env: |
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
# copy public key into authrized keys file: cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys | |
# chmod 600 ~/.ssh/authorized_keys | |
# create secrets in repo settings actions page. | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Download build artifacts |
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
# Rename the branch locally | |
git branch -m old-branch-name new-branch-name | |
# Push the renamed branch and set upstream | |
git push origin -u new-branch-name | |
# Delete the old branch from the remote repository | |
git push origin --delete old-branch-name | |
# Clean up local branches (optional) |
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\Datetime\DrupalDateTime; | |
// Check if the event's end date is not present | |
// or has been passed. | |
$current_time = new DrupalDateTime('now', 'UTC'); | |
if ($entity->get('field_event_end_date')->isEmpty() || ($current_time->getTimestamp() >= $entity->field_event_end_date->date->getTimestamp())) { | |
} | |
?> |
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 | |
/** | |
* Private file path: | |
* | |
* A local file system path where private files will be stored. This directory | |
* must be absolute, outside of the Drupal installation directory and not | |
* accessible over the web. | |
* | |
* Note: Caches need to be cleared when this value is changed to make the | |
* private:// stream wrapper available to the system. |
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
// Following steps are to setup Acquia BLt with Drupal 10 which is a kind of work around till gets resolved. | |
// These steps assuming you have all pre-requisuites done | |
// https://docs.acquia.com/blt/install/ | |
// https://docs.acquia.com/blt/install/adding-to-project/ | |
// Main point here is The Drupal root must be in a top-level "docroot" directory. | |
1. composer create-project --no-interaction --no-install drupal/recommended-project drupalblt | |
2. cd drupalblt | |
3. sudo sed -i '' -e "s|web/|docroot/|g" composer.json (replacing web/ with doctroot/ to make docroot the top-level directory) | |
4. composer require --dev thegbomb/blt-ddev |
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
// Dowload form_mode_manager from git and using composer. | |
"repositories": [ | |
{ | |
"type": "composer", | |
"url": "https://packages.drupal.org/8", | |
"exclude": [ | |
"drupal/form_mode_manager" | |
] | |
}, | |
{ |
NewerOlder