Allow tokens to be used in classes and attributes for HTML element.

Patch from field_group-tokens_in_classes-2858336-5-8.patch breaks the form display if classes are added. To fix this add an if statement to check for entity first.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bobbysaul created an issue. See original summary.

bobbysaul’s picture

Status: Active » Needs review
StatusFileSize
new3.68 KB

Here is the patch.

bemarlan’s picture

Assigned: bobbysaul » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new91.22 KB
new82.64 KB
new222.19 KB

@bobbysaul thanks for the patch. Your patch adds and allows tokens to be used successfully and it's working well. I have checked it using Acquia Dev Desktop and attached screenshots.

bemarlan’s picture

StatusFileSize
new3.18 KB

New patch tokens_in_attributes-2961885-2.patch added to work better with Tokens in field group's css classes patches.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 4: tokens_in_attributes-2961885-2.patch, failed testing. View results

bemarlan’s picture

bemarlan’s picture

StatusFileSize
new3.1 KB

Retesting patch.

bemarlan’s picture

StatusFileSize
new3.06 KB
bemarlan’s picture

StatusFileSize
new2.68 KB
bobbysaul’s picture

StatusFileSize
new5.42 KB

I have updated the patch.

bobbysaul’s picture

StatusFileSize
new5.53 KB

Updating again so it does not error out on the display form.

bobbysaul’s picture

nikitagupta’s picture

Assigned: Unassigned » nikitagupta
nikitagupta’s picture

Assigned: nikitagupta » Unassigned
Status: Needs work » Needs review
StatusFileSize
new5.27 KB
new3.23 KB

Fixed test case and coding standard.

yousefanbar’s picture

I rerolled the #13 patch to be compatible with Drupal 9 and field_group version 8.x-3.2.

rosk0’s picture

StatusFileSize
new5.57 KB

Review for #14.

  1. The patch and the interdiff doesn't match to each other - patch doesn't have validateId()
  2. Interdiff:
    +++ b/src/FieldGroupFormatterBase.php
    @@ -239,8 +239,7 @@
    -    $id = $form_state_values['fields'][$plugin_name]['settings_edit_form']['settings']['id'];
    -    if (!empty($id) && !preg_match('!^[A-Za-z0-9-_\[\]\:]+$!', $id)) {
    +    if (!empty($form_state_values['fields'][$plugin_name]['settings_edit_form']['settings']['id']) && !preg_match('!^[A-Za-z0-9-_]+$!', $form_state_values['fields'][$plugin_name]['settings_edit_form']['settings']['id'])) {
    

    reverts correct change from the previous patch for validateId().

RE #15 - I wasn't able to apply the patch with either composer-patches and manually with patch utility.

I re-rolled #14 fixing validation issue. Patch wasn't applying , had to fix conflicts manually , so no interdiff. This patch however is perfectly applicable to 3.2.

rosk0’s picture

maxmendez’s picture

Tested patch #16 on Drupal 9.4.5 and Field Group 8.x-3.2, seems to work perfectly.

lubna hmeid’s picture

StatusFileSize
new5.66 KB

I re-rolled the patch to be compatible with this issue
https://www.drupal.org/project/field_group/issues/2858336

pareshpatel’s picture

StatusFileSize
new5.62 KB

I found the issue with token replacement when we use the link field token. It encodes to & instead of & for link so I have fixed it and attached the patch file. Please verify.

xaa’s picture

Issue tags: -

patch from #20 working here. thanks

uditrawat’s picture

Status: Needs review » Reviewed & tested by the community

Yes, #20 is working, thanks

anybody’s picture

Version: 8.x-3.x-dev » 4.x-dev
Status: Reviewed & tested by the community » Needs work

Please use MR, not patches.

carma03 made their first commit to this issue’s fork.

mjgruta made their first commit to this issue’s fork.

mjgruta’s picture

StatusFileSize
new5.65 KB

Created a merge request from patch #20 plus changing the clean up code to only allow alphanumeric, hyphens, underscores, and space for classes.

Also adding here the static patch just in-case someone modifies the MR and breaks the code.

iorusoivan’s picture

The patch at the comment #20 work for me in version 8.x.3.4 since update to D 10.4, other version for this module not work a patch for me.
I'm waiting apply this patch, since update to Drupal 10. i could grantee it's work in Drupal 11.1.2 whit version 8.x.3.4. if merged to dev i will test quickly and i will send my feedback.