Hi.

I've seen that in a block variant, when you add a block you can't set custom css classes and ids, like you can do in drupal 7 with content panes.

Can this feature be added in Drupal 8? I am researching about how to add it.

Thanks!

Comments

mistermoper created an issue. See original summary.

omarlopesino’s picture

Issue summary: View changes
omarlopesino’s picture

StatusFileSize
new3.02 KB

Attach patch with a possible solution.
Settings are added in 'Operations' button, and styles added in buildBlock method.

Can you check this please?
Thanks!

omarlopesino’s picture

Status: Active » Needs review

Changing status to Needs review.

Status: Needs review » Needs work

The last submitted patch, 3: page_manager-block-css-attributes-3.patch, failed testing.

omarlopesino’s picture

StatusFileSize
new3.07 KB

Seeing the tests failed i found some errors in my patch.

Attach new patch with correction.

omarlopesino’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 6: page_manager-block-css-attributes-4.patch, failed testing.

omarlopesino’s picture

StatusFileSize
new3.59 KB

Attach updated patch adding schema info.

omarlopesino’s picture

omarlopesino’s picture

Status: Needs work » Needs review
jwineichen’s picture

I attempted to install this but I still don't see any options to add classes and ids.

andypost’s picture

This fixes regression otoh maybe better to implement more generic on top of https://www.drupal.org/project/styles_api

dobrzyns’s picture

I also do not see any options to add classes and ids. If I have some time, I'll take a closer look.

andypost’s picture

Don't hack related issues

dobrzyns’s picture

@andypost Sorry about that. The removal of the related issue was unintentional. Thanks for catching that and adding it back.

hypertext200’s picture

Status: Needs review » Needs work

This appeared to be not working.

samerali’s picture

This appears not to be working per @heshnlk said.

The problem seems that the settings does actually exist at the "Edit Block" level.

But when you load them through PageBlockDisplayVariant->buildRegions it builds the configuration array without the css (or the new custom) attributes.

any idea why this is going on?

samerali’s picture

Actually this page_manager-block-css-attributes-9.patch does work.

I totally missed that i should have clicked "update & save" to save the tempstore into the configuration.

Thanks for the efforts @mistermope

samerali’s picture

Status: Needs work » Needs review
bbujisic’s picture

StatusFileSize
new4.62 KB
new1.01 KB

Patch page_manager-block-css-attributes-9.patch worked nice for new module installations. However, it required hook_update_N() for existing page manager config.

New patch loops through existing page variant config and amends block settings where needed.

samerali’s picture

I have been using #9 for a while and it's working great for me (real help), I think @bbujisic #21 just perfected it. Any reason we are not merging this yet?

andypost’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests
+++ b/page_manager.install
@@ -32,3 +32,24 @@ function page_manager_requirements($phase) {
+      if (empty($block['css_classes'])) {
+        $block['css_classes'] = '';
+      }
+      if (empty($block['css_id'])) {
+        $block['css_id'] = '';
+      }
+      $config->set('variant_settings.blocks.' . $block_id, $block);
+    }
+    $config->save(TRUE);
+  }
+}
\ No newline at end of file

I'm sure, resave should happens only when both properties is unset.

+ needs newline at the end file

jian he’s picture

Version: 8.x-1.x-dev » 8.x-4.x-dev
StatusFileSize
new4.55 KB
new1.04 KB

Fix #23 and reroll to 8.x-4.x

max-kuzomko’s picture

Assigned: Unassigned » max-kuzomko
max-kuzomko’s picture

Assigned: max-kuzomko » Unassigned

For some reason there is no option to run 4.x tests on drupal.org

jlballes’s picture

I have applied the last patch and I don't see the fields Css classes and Css ID
I have tried to run update.php at it don´t find any update. Of course I´ve deleted cache with drush cr
My Page Manager version is 8.x-4.0-beta2

Thanks in advanced

ericmulder1980’s picture

If i understand correctly this issue is about adding custom attributes in the Panelizer UI forms. I don't see any reference however to being able to add / edit custom attributes while using panels IPE. Would it be an option to expand the scope of this issue to also implement this?

ptsimard’s picture

StatusFileSize
new4.55 KB

Reroll #24 on top of latest commit (8.x-4.0-rc3)