You are here

function flexiform_add_modal_button_content_type_render in Flexiform 7

Render the custom content type.

File

plugins/content_types/add_modal_button.inc, line 106
Plugin to handle attached entity content types

Code

function flexiform_add_modal_button_content_type_render($subtype, $conf, $panel_args, $context) {
  $flexiform = entity_load_single('flexiform', $subtype);
  $title = $flexiform
    ->getDisplay('FlexiformDisplayCreateModal')
    ->title();
  ctools_include('ajax');
  ctools_include('modal');
  ctools_modal_add_js();
  $path = "flexiform/{$subtype}/ajax";
  $content = '';
  if (drupal_valid_path($path)) {
    $content = ctools_modal_text_button($title, url($path, array(
      'absolute' => TRUE,
    )), $title, $conf['button_class']);
  }

  // Build the content type block.
  $block = new stdClass();
  $block->module = 'flexiform';
  $block->title = '';
  $block->content = $content;
  $block->delta = $subtype;
  return $block;
}