You are here

public function AuthorPane::display in Author Pane 8.3

Returns a string containing the the author pane.

Return value

string

File

src/Entity/AuthorPane.php, line 115
Contains \Drupal\author_pane\Entity\AuthorPane.

Class

AuthorPane
Defines an AuthorPane configuration entity class.

Namespace

Drupal\author_pane\Entity

Code

public function display() {
  $author = $this
    ->getAuthor();
  if ($author instanceof UserInterface) {
    $author_pane_data = $this->datumPluginManager
      ->getDefinitions();
    $content = '';
    foreach ($author_pane_data as $datum_array) {

      // Make an instance of the datum.
      $datum = $this->datumPluginManager
        ->createInstance($datum_array['id']);
      $datum
        ->setAuthor($author);

      // @TODO: Theme this properly with a template.
      $content .= $datum
        ->output();
    }
  }
  else {
    $content = $this . t('No author set.');
  }
  return $content;
}