You are here

public function Flexiform::createDisplay in Flexiform 7

File

./flexiform.entity.inc, line 67
flexiform.entity.inc

Class

Flexiform
The class used for flexiform entities

Code

public function createDisplay($display) {
  $display_info = flexiform_display_info($display);
  if (empty($display_info)) {
    drupal_set_message(t('Display plugin @plugin not found.', array(
      '@plugin' => $display,
    )), 'error');
    return new FlexiformDisplayNull($this, $this->displays[$display]);
  }
  $class_name = $display_info['class'];
  if (!class_exists($class_name)) {
    throw new Exception(t('Display class @class does not exist.', array(
      '@class' => $class_name,
    )));
  }
  return new $class_name($this);
}