Skip to content
This repository was archived by the owner on May 9, 2024. It is now read-only.

Add custom block creation/deletion profile helpers #9

Open
wants to merge 2 commits into
base: 7.x-1.x
Choose a base branch
from
Open

Add custom block creation/deletion profile helpers #9

wants to merge 2 commits into from

Conversation

jamsilver
Copy link
Contributor

This adds two functions:

cm_tools_block_custom_add()
cm_tools_block_custom_delete()

For adding/removing custom blocks.

It supports the usual core block settings, plus the content_type placement settings provided by the node module.

* @see block_add_block_form_submit().
*/
function cm_tools_block_custom_add($admin_label, $title, $body, $body_format = NULL, $region = BLOCK_REGION_NONE, $weight = 0, $settings = array()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to take a big array of options with some nice defaults rather than a huge list of params please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does take an array of options with some nice defaults.
It just also takes the 6 things you'll want to supply every time as separate parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I felt that this was the right balance.
And I think you'll find that it perfectly conforms to the published CMTools coding conventions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could move $region and $weight into settings, to keep it tight I suppose.

I think it would be a bit fruity if all the parameters where in an array.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, that some consistency between these and cm_tools_block_position() would be pretty sweet actually.

Not to mention moving that function also into profile.inc.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stop commenting!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants