Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Blocks tab doesn't appear in ss3.3.2 and ss3.4.0 #98

Closed
brasileric opened this issue Jun 12, 2016 · 7 comments
Closed

The Blocks tab doesn't appear in ss3.3.2 and ss3.4.0 #98

brasileric opened this issue Jun 12, 2016 · 7 comments

Comments

@brasileric
Copy link

brasileric commented Jun 12, 2016

Hi,
In the pages the tab Blocks doesn't appear in ss3.3.2 and ss3.4.0 with silverstripe-blocks versions 1.0.8 and above (tested 1.0.8 and 1.0.11). When I use version 1.0.7 the tab is there and everything works as expected.

@sheadawson
Copy link
Owner

Please check your yml block config against the example given in the readme. If you can't see the issue, paste your config here and I'll have a look at it

@brasileric
Copy link
Author

Hi sheadawson,

This is my block config in /mysite/_config/config.yml (as I said works fine till version 1.0.7):

BlockManager:
themes:
main:
areas:
AfterContent: true

Thanks!

@sheadawson
Copy link
Owner

sheadawson commented Jun 15, 2016

I suspect this is an issue with how your themes are set, and how this module checks for which theme is set. I'm not sure at the moment if we should change how the module does this, need to think a bit more about it.

The blocks code in question is here https://github.com/sheadawson/silverstripe-blocks/blob/master/code/BlockManager.php#L143, the getTheme method.

To fix the issue from your end, I think you need to choose how you want to set your theme. Either in yml config via SSViewer:theme or in the SiteConfig (CMS Settings area), but not both. Let me know how you go :)

@brasileric
Copy link
Author

Thanks for reply.
I tried something with your suggestion in v 1.0.11, but I think this isn't the issue. I removed the theme set from the yml file. Even when I change this method to:

    private function getTheme()
    {
                return "main";
    }

So when I hard coded my theme, the Blocks tab doesn't appear, back to 1.0.7 it appears. I have this issue in multiple websites, so if this happens to me only I do something wrong structurally :) Well, for now 1.0.7 works fine for me.

@sheadawson
Copy link
Owner

Interesting. Yeah I've double checked my test: fresh install of SS 3.4.0, Blocks 1.0.11, your exact yml config and I see the blocks tab.

If you have a moment to check, it probably wouldn't be too hard to debug if you follow the code through from the logic at the top of BlocksSiteTreeExtension->updateCMSFields method

@brasileric
Copy link
Author

I found the problem:

In line 68 of BlocksSiteTreeExtension->updateCMSFields there is no default translation for Blocks:

$fields->addFieldToTab('Root', new Tab('Blocks', _t('Block.PLURALNAME')));

So if the used language has a language yaml file the tab will have a name and will appear. But for my language (Dutch) there is no yaml file, so no name to display.

So this line should be:

$fields->addFieldToTab('Root', new Tab('Blocks', _t('Block.PLURALNAME', 'Blocks')));

In version 1.0.7 no translation is used yet :)

@sheadawson
Copy link
Owner

I see, thanks for that!

sheadawson added a commit that referenced this issue Jun 21, 2016
* master:
  fix blocks tab not showing in some cases. Fixes #98
  implement pagetype_black/whitelist. Fixes #39
  update .editorconfig php use tabs not spaces
  Add translatbale gist to readme
  Remove validation on Block Title field
  Add scrutinizer badge
  Allow BlockAreaName translations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants