Drupal Answers Asked by Aaron S. on December 12, 2021
Can anyone provide sample code for a custom module and/or provide a reference for hook_ds_fields_info that utilizes ‘field_type’ => DS_FIELD_TYPE_BLOCK, that will actually render in admin/structure/ds/fields. I’m working in 7.2-2.14 of display suite.
The API documentation appears to be incomplete as listed here:
http://www.drupalcontrib.org/api/drupal/contributions%21ds%21ds.api.php/function/hook_ds_fields_info/7.
I’m thinking I may be missing some sort of related render function for the block to appear (https://ohthehugemanatee.org/blog/2014/04/02/how-to-create-a-custom-display-suite-field/) however even using this example barebones in a standalone module I don’t necessarily get my custom block to show. I am referencing a custom block initially built out in a custom module.
function module_ds_fields_info($entity_type) {
$fields = array();
$fields['title'] = array(
'title' => t('My Custom Module'),
'field_type' => DS_FIELD_TYPE_BLOCK,
'ui_limit' => array('article|*', 'audience_page|*', 'overview_page|*', 'page|*', 'product|*', 'product_overview|*'),
'properties' => array(
'block' => 'my_custom_module',
'block_render' => DS_BLOCK_CONTENT,
),
);
return array('node' => $fields);
}
As already reported in this DS issue, you need to alter DS_BLOCK_CONTENT to DS_BLOCK_TEMPLATE.
We had a similar issue where from a certain point in time, the block was no longer rendered. That point in time was a security update on the DS module, we applied somewhere a month ago : https://www.drupal.org/sa-contrib-2018-019
Answered by rawdesk.be on December 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP