mercury_editor-2.0.x-dev/src/Entity/MercuryEditorNodeForm.php
src/Entity/MercuryEditorNodeForm.php
<?php
namespace Drupal\mercury_editor\Entity;
use Drupal\node\NodeForm;
/**
* Node form for mercury editor edit tray.
*
* Note that this class extends an internal entity form class to provide
* additional functionality specific to the Mercury Editor context.
*
* @phpstan-ignore-next-line
*/
class MercuryEditorNodeForm extends NodeForm implements MercuryEditorEntityFormInterface {
use MercuryEditorEntityFormTrait;
/**
* {@inheritDoc}
*/
public function setDefaultEntityValues() {
$this->entity->in_preview = TRUE;
$this->entity->preview_view_mode = 'full';
if (empty($this->entity->title->value)) {
$this->entity->title = $this->t('New :type', [':type' => $this->entity->type->entity->label()]);
}
}
}
