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\sandbox\Form; | |
use Drupal\Core\Form\FormBase; | |
use Drupal\Core\Form\FormInterface; | |
use Drupal\Core\Form\FormState; | |
use Drupal\Core\Form\FormStateInterface; | |
use Drupal\node\Entity\Node; | |
use Drupal\user\Entity\User; |
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\Form\FormStateInterface; | |
use Drupal\paragraphs\Entity\ParagraphsType; | |
/** | |
* Implements hook_form_alter(). | |
*/ | |
function example_form_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
$form_ids = [ |
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 | |
function mymodule_update_9001(&$sandbox) { | |
// Initialize variables on the first run. | |
if (!isset($sandbox['total'])) { | |
$entity_list = \Drupal::entityQuery('node') | |
->condition('type', 'my_entity') | |
->execute(); | |
$langcodes = \Drupal::languageManager()->getLanguages(); | |
$sandbox['langcodes'] = array_keys($langcodes); |
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
Array | |
( | |
[uuid] => d0e01c96-4fe9-491d-8a00-f42e3b84465e | |
[langcode] => en | |
[status] => 1 | |
[dependencies] => Array | |
( | |
[config] => Array | |
( | |
[0] => field.field.node.page.body |
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
function some_theme_preprocess_paragraph(&$variables) { | |
$element = &$variables['elements']; | |
$paragraph = $variables['paragraph']; | |
if ($paragraph->getType() === 'image_gallery') { | |
$images = $paragraph->get('field_image_gallery'); | |
foreach ($images->referencedEntities() as $image) { | |
$image->parent_paragraph = $paragraph; | |
} | |
} |
OlderNewer