function claro_element_info_alter

Same name in other branches
  1. 9 core/themes/claro/claro.theme \claro_element_info_alter()
  2. 10 core/themes/claro/claro.theme \claro_element_info_alter()
  3. 11.x core/themes/claro/claro.theme \claro_element_info_alter()

Implements hook_element_info_alter().

File

core/themes/claro/claro.theme, line 232

Code

function claro_element_info_alter(&$type) {
    // Add a pre-render function that handles the sidebar of the node form.
    // @todo Refactor when https://www.drupal.org/node/3056089 is in.
    if (isset($type['container'])) {
        $container_pre_renders = !empty($type['container']['#pre_render']) ? $type['container']['#pre_render'] : [];
        array_unshift($container_pre_renders, [
            ClaroPreRender::class,
            'container',
        ]);
        $type['container']['#pre_render'] = $container_pre_renders;
    }
    // @todo Refactor when https://www.drupal.org/node/3016343 is fixed.
    if (isset($type['text_format'])) {
        $type['text_format']['#pre_render'][] = [
            ClaroPreRender::class,
            'textFormat',
        ];
    }
    // Add a pre-render function that handles dropbutton variants.
    if (isset($type['dropbutton'])) {
        $type['dropbutton']['#pre_render'][] = [
            ClaroPreRender::class,
            'dropButton',
        ];
    }
    if (isset($type['vertical_tabs'])) {
        $type['vertical_tabs']['#pre_render'][] = [
            ClaroPreRender::class,
            'verticalTabs',
        ];
    }
    // Add a pre-render to managed_file.
    if (isset($type['managed_file'])) {
        $type['managed_file']['#pre_render'][] = [
            ClaroPreRender::class,
            'managedFile',
        ];
    }
    // Add a pre-render to status_messages to alter the placeholder markup.
    if (isset($type['status_messages'])) {
        $type['status_messages']['#pre_render'][] = [
            ClaroPreRender::class,
            'messagePlaceholder',
        ];
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.