0

I'm attempting to edit page restrictions on the 'Main Page Content' block, however I'm not able to save any changes to the block because it complains about the machine name having capital letters in it.

enter image description here

The machine name for the block is THEME_content. I'm assuming because the theme name has capital letters in it. However because of this I can't make any changes to it, since it checks the machine name upon saving. There is a text field for the machine name but it does not allow me to edit it. Is there anyway I can change the machine name? Or make it so that I can save this block despite the name?

2

1. First of all, The step you are showing, at that step you can easily change the machine-name, See in following image, where I have created the block 'Main Page Content' and it is not allowing me to go ahead, before changing the block machine-name. Hence, you can easily change the machine-name here. Hence there is no problem in editing the machine-name.

Secondly, if system is saying, you can not use capital letter, then simply you can't as system designed in that way.

enter image description here

2. Main Page Content Why you want to give your block name Main Page Content title, Block with same name with machine-name theme_content has already been provided by the default Drupal 8. So, why you wan to create the another block with same title and same kind of machine-name. That block(Main Page Content) is used for displaying the main content which is not supposed to be changed. If you want just create the other custom block and place it in CONTENT region.

3. Once the machine-name is stored in the database, practically you can't change that. please read the accepted answer of this Question How do I change the machine name of a field once it's been created.

4. Till which step you can edit machine-name: After creating the block and before final saving, you can see the edit link in the following image. So at that time you can change the machine-name. And before placing it in the region. Once you places block and it gets enabled, after that you can not change the machine-name.

enter image description here

  • So there isn't a way to save any changes to the block unless I edit the database directly? My main goal is simply change an option on that page. – Matt Sep 16 '16 at 20:45
  • Before that, I would like to know, which block's machine name you wan to change, The block Main Page Content(System) which comes in Drupal 8 by default, Or You have created a Custom block and given a name Main Page Content? – CodeNext Sep 16 '16 at 20:51
  • It's the Main Page Content system block that comes with 8 by default – Matt Sep 16 '16 at 20:52
  • I think that block you should not touch, that block provided by system to display page content. And if you want to display anything in content region, simple create the other block and put in content region. I think you need to re-think what you want to display and why you want to change the machine-name. – CodeNext Sep 16 '16 at 21:03
0

I think this is a bug in Drupal 8. I am having the same problem... I attempted to uncheck the sitename in the system block, but found I could not save the change. I am unable to edit the field marked in red. I have capitol letters in the sitename (I have my reasons), and Drupal should be converting those to lowercase before assigning the machine name. Normally it does this elsewhere. But in this case, it fails to do so, thus creating an irreconcilable error. You are stuck with the error for this block until the bug is fixed.

You can, however, disable that block on the "Structure/Block-Layout" page, and create a new one that has the same effect, for instance, presenting the site logo as navigation to the home page, but leaving off the site name.

You can inspect your site as it is now -- (Ctrl+U) or right-click/Inspect -- to see what you want the code to look like in that new block.

Once you create the new logo block, click the tab for Block Layout, then press "Place block" next to the navigation region. Select your new block, and you should be good to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.