Commit f11ed54b authored by ressa's avatar ressa Committed by Merlin Axel Rutz
Browse files

Issue #3274425 by ressa: Add Token module information

parent 98aee108
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
name: "Entity Prepopulate"
type: module
description: "Prepopulate entity values via tokens."
description: "Prepopulate entity values via tokens. Install the Token module for more tokens and Token browser access."
core_version_requirement: ^8.7.7 || ^9
+13 −5
Original line number Diff line number Diff line
@@ -86,16 +86,24 @@ function epp_form_alter(&$form, FormStateInterface $form_state, $formId) {
  $form['third_party_settings']['epp']['#type'] = 'fieldset';
  $form['third_party_settings']['epp']['#title'] = t('Entity Prepopulate');

  $description = t('The values will only be applied if all tokens are replaced. If the value is not valid, no replacement will happen. You can use Yaml syntax to target field properties. You can use tokens.');

  if (!\Drupal::moduleHandler()->moduleExists('token')) {
    $description .= '<br>' . t('For more tokens and Token browser access, please install the <a href="https://www.drupal.org/project/token">Token</a> module. See the <a href="https://www.drupal.org/docs/contributed-modules/entity-prepopulate">documentation</a> for more information.');
  }

  $form['third_party_settings']['epp']['value'] = [
    '#type' => 'textarea',
    '#title' => t('Value'),
    '#description' => t('The values will only be applied if all tokens are replaced. If the value is not valid, no replacement will happen. You can use Yaml syntax to target field properties. You can use tokens.'),
    '#description' => $description,
    '#default_value' => $fieldConfig->getThirdPartySetting('epp', 'value'),
  ];
  if (\Drupal::moduleHandler()->moduleExists('token')) {
    $form['third_party_settings']['epp']['token_tree'] = [
      '#theme' => 'token_tree_link',
      '#token_types' => [],
    ];
  }
  $form['third_party_settings']['epp']['on_update'] = [
    '#type' => 'checkbox',
    '#title' => t('Also on update'),