You are here

function insert_colorbox_insert_render in Insert 8.2

Implements hook_insert_render().

File

modules/insert_colorbox/insert_colorbox.module, line 192

Code

function insert_colorbox_insert_render($styleName, array $vars) {
  $moduleName = explode('__', $styleName, 2)[0];
  if ($moduleName !== 'colorbox') {
    return [];
  }
  $templateStyleName = str_replace('-', '_', $styleName);
  $templateFieldName = str_replace('-', '_', $vars['field_name']);
  return \Drupal::theme()
    ->render([
    'insert_colorbox_image__' . $templateFieldName . '__' . $templateStyleName,
    'insert_colorbox_image__' . $templateFieldName,
    'insert_colorbox_image__' . $templateStyleName,
    'insert_colorbox_image',
  ], $vars);
}