Download & Extend

Rename custom_block.module to block_custom.module

Project:Drupal core
Version:8.x-dev
Component:block.module
Category:task
Priority:major
Assigned:larowlan
Status:needs work
Issue tags:API clean-up

Issue Summary

Follow-up to: #1871772: Convert custom blocks to content entities

Problem

  • custom* module names are the informal standard namespace for custom developed, site-specific modules.
  • I have at least a dozen of sites that have a custom_block.module already (among other custom* modules).

Proposed solution

  1. Rename custom_block.module to block_custom.module.
  2. Move the module directly into /core/modules/
  3. Add a block_custom.module component for issues to d.o.

Comments

#1

Title:Rename custom_block.module to block_clustom.module» Rename custom_block.module to block_custom.module

#2

The module should also be moved directly into /core/modules/. Updated the issue summary accordingly.

#3

+1 for this change.

#4

+1 here, this overlaps with a lot of custom modules done for specific sites.

#5

Status:active» postponed

This will clash with #1919910: Refactor custom_block upgrade path to create tables using hook_schema_0() instead of in block_update_N() - can we get that in first?
Needs review.

#6

Oh god this just completely bit me for several hours. Adding a custom module completely hoses your Drupal 8 site the moment you enable it: #1929720: How the bleepity bleep do you debug missing use statements in classes? because custom_block_load() then becomes a hook_block_load() implementation with block entity objects being passed into it rather than entity IDs like it expects. And core *should* have failed gracefully if you pass in non-numeric entity IDs, except it doesn't. It explodes into a firey death from which you cannot recover due to #1003788: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID.

A death of a thousand suns should be administered to custom_block namespace.

#7

I'd like to suggest we rename this block_content instead of block_custom. Any issues with that?

Eclipse

#8

Status:postponed» active

Perhaps it's bikeshed time, even? :)

I actually wonder whether we couldn't find a name that doesn't have "block" in it… That is, because all of the function names and class names (à la CustomBlockBlock or custom_block_block_view_alter() :P) are a little bit confusing.

We apparently had a very nice and short name for certain blocks in D6 and below: Boxes.

box.module?

#9

I really had some hate with block_box_get()... Very inconsistent naming and once an object and once an array and sometimes a different array structure... :-(

#10

#1919910: Refactor custom_block upgrade path to create tables using hook_schema_0() instead of in block_update_N() is in, I'm just curious to see what breaks with a relatively dumb script.

AttachmentSizeStatusTest resultOperations
custom-block-block-custom.patch83.72 KBIdleFAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.View details | Re-test

#11

Status:active» needs review

#12

Status:needs review» needs work

The last submitted patch, custom-block-block-custom.patch, failed testing.

#13

Status:needs work» needs review

<paint target="bikeshed">how about content_block?</paint>

#14

Status:needs review» needs work

The last submitted patch, custom-block-block-custom.patch, failed testing.

#15

Status:needs work» needs review

Whoops, forgot the rename bit.

The good thing is, as long as the patch applies, picking a new name is easy, since you can just edit the patch file directly.

AttachmentSizeStatusTest resultOperations
custom-block-1920862-15.patch91.64 KBIdleFAILED: [[SimpleTest]]: [MySQL] 51,257 pass(es), 33 fail(s), and 4,834 exception(s).View details | Re-test

#16

Status:needs review» needs work

The last submitted patch, custom-block-1920862-15.patch, failed testing.

#17

Assigned to:Anonymous» larowlan

I'll kick this along later today, I was expecting the upgrade path to fail, thats why we were waiting on #1919910: Refactor custom_block upgrade path to create tables using hook_schema_0() instead of in block_update_N() - the rest looks straight forwardish

#18

Not content_block, because this would result in the same problem when a content.module exists and is enabled on the site.

#19

Right, I still really like block_content.module. I think it actually says what it is, and solves the other problems that lead to this issue.

Eclipse

#20

block_content works for me

#21

+1 for block_content

#22

Status:needs work» needs review

So this uses block_content.
Upgrade path should pass this time because block_content != existing {block_custom} table in D7.
So change to any other name should be straight forward, using block_custom will require new upgrade path that adds fields to the existing table.

Note module is still called 'Custom Block' and so are entities, I don't think 'Block Content' fits in that regards. I still like 'Add custom block' better than 'Add block content'.

AttachmentSizeStatusTest resultOperations
custom-block-rename.22.patch98.21 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch custom-block-rename.22.patch. Unable to apply patch. See the log in the details link for more information.View details | Re-test

#23

Status:needs review» needs work

The last submitted patch, custom-block-rename.22.patch, failed testing.

#24

Status:needs work» needs review

#22: custom-block-rename.22.patch queued for re-testing.

#25

green :)
We just need to agree on whether we change the entity names, module name etc too

#26

@larowlan please use -M25% to minimize a patch size
I think classes and other parts should be renamed too

#27

#22: custom-block-rename.22.patch queued for re-testing.

#28

Status:needs review» needs work

The last submitted patch, custom-block-rename.22.patch, failed testing.