The function you are showing is an implementation of hook_builder_content_info()
. Without seeing the code that calls that hook, I cannot answer about removing the vertical tabs, but I can just give some hints.
If the module also invokes hook_builder_content_info_alter()
, which is normally done from the majority of the Drupal modules using hooks, you can implement hook_builder_content_info_alter()
in a module.
/**
* Implements hook_builder_content_info_alter()
*/
function builder_gc_builder_content_info_alter(&$contents) {
unset($contents['node']['group']);
}
The alter hook could get other arguments, but the structure to change is always the first.
If the module doesn't invoke any hook_builder_content_info_alter()
you need to:
- Avoid Drupal invokes
builder_builder_content_info()
- Implement
hook_builder_content_info()
using the same code used by builder_builder_content_info()
but without those parts that you don't want
This can be done with the following code.
function builder_gc_module_implements_alter(&$implementations, $hook) {
if ($hook == 'builder_content_info') {
// Remove the implementation done from that module.
unset($implementations['builder']);
}
}
function builder_gc_builder_content_info() {
$blocks = _block_rehash();
$contents = array();
if (!empty($blocks)) {
foreach ($blocks as $key => $block) {
$contents[$block['delta']] = array(
'info' => $block['info'],
'type' => 'block',
'group' => t('Block'),
// This is name of group to collect contents in a tab
'block_module' => $block['module'],
);
}
}
// node add content
$contents['node'] = array(
'info' => t('Adding existing node'),
);
//Custom text
$contents['custom_text'] = array(
'info' => t('Custom text'),
'group' => t('Text'),
);
// Custom heading
$contents['custom_heading'] = array(
'info' => t('Custom heading'),
'group' => t('Text'),
'no_title' => TRUE,
);
// Insert image
$contents['image'] = array(
'info' => t('Insert an image'),
'group' => t('Image'),
);
$contents['youtube'] = array(
'info' => t('Youtube'),
'group' => t('Video'),
);
$contents['vimeo'] = array(
'info' => t('Vimeo'),
'group' => t('Video'),
);
$contents['icon'] = array(
'info' => t('Icon'),
'group' => t('Icon'),
);
return $contents;
}
The code I am showing should avoid the information is shown in vertical tabs, but it doesn't avoid the vertical tabs are created. The only way to be sure is to alter the function that invokes hook_builder_content_info()
. Using hook_builder_content_info_alter()
, you are sure to alter the value returned from all the hook_builder_content_info()
implementations, while the other snippet I shown just alters the value returned from a module. If there are two modules passing 'node'
as group, the vertical tab will be created, since I am not altering what returned from the other module.
Also, the code I am showing removes the 'group'
property, which I am guessing sets the vertical tab where the information is shown, similarly to the #group property used by fieldsets.
Alternatively, you can use the following code, which removes completely the information about the part you don't want to see.
// Case 1.
/**
* Implements hook_builder_content_info_alter()
*/
function builder_gc_builder_content_info_alter(&$contents) {
unset($contents['node']);
}
// Case 2.
function builder_gc_module_implements_alter(&$implementations, $hook) {
if ($hook == 'builder_content_info') {
// Remove the implementation done from that module.
unset($implementations['builder']);
}
}
function builder_gc_builder_content_info() {
$blocks = _block_rehash();
$contents = array();
if (!empty($blocks)) {
foreach ($blocks as $key => $block) {
$contents[$block['delta']] = array(
'info' => $block['info'],
'type' => 'block',
'group' => t('Block'),
// This is name of group to collect contents in a tab
'block_module' => $block['module'],
);
}
}
//Custom text
$contents['custom_text'] = array(
'info' => t('Custom text'),
'group' => t('Text'),
);
// Custom heading
$contents['custom_heading'] = array(
'info' => t('Custom heading'),
'group' => t('Text'),
'no_title' => TRUE,
);
// Insert image
$contents['image'] = array(
'info' => t('Insert an image'),
'group' => t('Image'),
);
$contents['youtube'] = array(
'info' => t('Youtube'),
'group' => t('Video'),
);
$contents['vimeo'] = array(
'info' => t('Vimeo'),
'group' => t('Video'),
);
$contents['icon'] = array(
'info' => t('Icon'),
'group' => t('Icon'),
);
return $contents;
}
If this code doesn't work, you could follow the following steps, in order to change the module behavior:
- Check which function is invoking
hook_builder_content_info()
- Verify if there is a reference to that function in one of the hooks Drupal uses (e.g.
hook_menu()
); the reference could be either direct or indirect (i.e., the reference is for a function that calls the function invoking hook_builder_content_info()
)
- If this is the case, using the alter hook Drupal uses (e.g.
hook_menu_alter()
), you can change that reference with a reference to a function you write, which uses the code the original function uses, without the part you don't want.
In this way, you aren't directly altering the values returned from hook_builder_content_info()
, and you need to copy more of the code used from the module for which you are altering the behavior; this is also means that, for every minimal change in the module you bought, you need to check your code to be sure it doesn't alter the expected behaviour.