code: protected function generateElement($table, $content, $replace, $elementId)
      {
          $sql = sprintf('SELECT * FROM %s WHERE id=? AND type="metamodels_frontendclearall"', $table);
  
          $statement = $this->connection->prepare($sql);
          $statement->bindValue(1, $elementId);
          $statement->execute();
  
          $objDbResult = $statement->fetch(\PDO::FETCH_OBJ);
  
          // Check if we have a existing module or ce element.
          if ($objDbResult === false) {
              return str_replace($replace, '', $content);
          }
  
          // Get instance and call generate function.
          if ($table == 'tl_module') {
              $objElement = new ModuleFilterClearAll($objDbResult);
          } elseif ($table == 'tl_content') {
              $objElement = new ContentElementFilterClearAll($objDbResult);
          } else {
              return str_replace($replace, '', $content);
          }
  
          return str_replace($replace, $objElement->generateReal(), $content);
      }
docs: Render a module or content element.
  
  @param string $table     The name of the table.
  
  @param string $content   The html content in which to replace.
  
  @param string $replace   The string within the html to be replaced.
  
  @param int    $elementId The id of the module/ce-element to be inserted for the replace string.
  
  @return string
  
  @throws \Doctrine\DBAL\DBALException When a database error occur.