Commit 6fa0b23f authored by mxh's avatar mxh
Browse files

Issue #3254006 by mxh: Make the usage of the label pattern more intuitive

parent 6c0e119c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ use Drupal\user\EntityOwnerTrait;
 * @ContentEntityType(
 *   id = "field_bundle",
 *   label = @Translation("Field bundle"),
 *   label_collection = @Translation("Field bundles"),
 *   label_collection = @Translation("Field bundle items"),
 *   bundle_label = @Translation("Field bundle config"),
 *   label_singular = @Translation("field bundle item"),
 *   label_plural = @Translation("field bundle items"),
+5 −5
Original line number Diff line number Diff line
@@ -61,10 +61,10 @@ class FieldBundleConfigForm extends BundleEntityFormBase {
    }

    $form['label'] = [
      '#title' => $this->t('Label'),
      '#title' => $this->t('Config label'),
      '#type' => 'textfield',
      '#default_value' => $bundle_config->label(),
      '#description' => $this->t('The human-readable config name of this field bundle.'),
      '#description' => $this->t('The human-readable name of this field bundle configuration.'),
      '#required' => TRUE,
      '#size' => 30,
    ];
@@ -84,13 +84,13 @@ class FieldBundleConfigForm extends BundleEntityFormBase {
      '#title' => $this->t('Description'),
      '#type' => 'textarea',
      '#default_value' => $bundle_config->getDescription(),
      '#description' => $this->t('Describe this field bundle. The text will be displayed on the <em>Add new field bundle</em> page.'),
      '#description' => $this->t('Describe this field bundle config. The text will be displayed on the <em>Add field bundle item</em> page.'),
    ];

    $form['label_pattern'] = [
      '#title' => $this->t('Label pattern'),
      '#title' => $this->t('Pattern for automatic label generation'),
      '#type' => 'textfield',
      '#description' => $this->t('Define a pattern to use for creating the label of the field bundle. Tokens are allowed, e.g. [bundle:config-label]. Leave empty to not use any pattern.'),
      '#description' => $this->t('Instead of manually entering a label on each field bundle item within a form, you can define a label pattern here for auto-generating a value for it. This pattern will be applied everytime a field bundle item is being saved. Tokens are allowed, e.g. [bundle:string-representation]. Leave empty to not use a name pattern for items of this bundle config. If a label pattern is being used, you may optionally hide the label field in the <em>Manage form display</em> settings.'),
      '#default_value' => $bundle_config->getLabelPattern(),
      '#size' => 255,
      '#maxlength' => 255,