TestWordPrintEngine.php in Entity Print 8.2
File
tests/modules/entity_print_test/src/Plugin/EntityPrint/PrintEngine/TestWordPrintEngine.php
View source
<?php
namespace Drupal\entity_print_test\Plugin\EntityPrint\PrintEngine;
use Drupal\Core\Form\FormStateInterface;
use Drupal\entity_print\Plugin\PrintEngineBase;
class TestWordPrintEngine extends PrintEngineBase {
protected $html = '';
public function addPage($content) {
$this->html .= $content;
}
public function send($filename, $force_download = TRUE) {
echo $filename;
echo 'Using ' . $this
->getPluginId();
echo $this->html;
}
public function getBlob() {
return '';
}
public function defaultConfiguration() {
return [
'test_word_setting' => 'my-default',
];
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['test_word_setting'] = [
'#title' => $this
->t('Test Word setting'),
'#type' => 'textfield',
'#default_value' => $this->configuration['test_word_setting'],
'#description' => $this
->t('Test setting'),
];
return $form;
}
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
$this->configuration['test_word_setting'] = $form_state
->getValue([
'test_word_print_engine',
'test_word_setting',
]);
}
public static function dependenciesAvailable() {
return TRUE;
}
public function getPrintObject() {
}
}