class QuickNodeCloneNodeController in Quick Node Clone 8
Returns responses for Quick Node Clone Node routes.
Hierarchy
- class \Drupal\Core\Controller\ControllerBase implements ContainerInjectionInterface uses LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\node\Controller\NodeController implements ContainerInjectionInterface
- class \Drupal\quick_node_clone\Controller\QuickNodeCloneNodeController
- class \Drupal\node\Controller\NodeController implements ContainerInjectionInterface
Expanded class hierarchy of QuickNodeCloneNodeController
File
- src/
Controller/ QuickNodeCloneNodeController.php, line 17
Namespace
Drupal\quick_node_clone\ControllerView source
class QuickNodeCloneNodeController extends NodeController {
/**
* The entity form builder.
*
* @var \Drupal\quick_node_clone\Form\QuickNodeCloneEntityFormBuilder
*/
protected $qncEntityFormBuilder;
/**
* Constructs a NodeController object.
*
* @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
* The date formatter service.
* @param \Drupal\Core\Render\RendererInterface $renderer
* The renderer service.
* @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
* The entity repository.
* @param \Drupal\quick_node_clone\Entity\QuickNodeCloneEntityFormBuilder $entity_form_builder
* The entity form builder.
*/
public function __construct(DateFormatterInterface $date_formatter, RendererInterface $renderer, EntityRepositoryInterface $entity_repository, QuickNodeCloneEntityFormBuilder $entity_form_builder) {
parent::__construct($date_formatter, $renderer, $entity_repository);
$this->qncEntityFormBuilder = $entity_form_builder;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('date.formatter'), $container
->get('renderer'), $container
->get('entity.repository'), $container
->get('quick_node_clone.entity.form_builder'));
}
/**
* Retrieves the entity form builder.
*
* @return \Drupal\quick_node_clone\Form\QuickNodeCloneFormBuilder
* The entity form builder.
*/
protected function entityFormBuilder() {
return $this->qncEntityFormBuilder;
}
/**
* Provides the node submission form.
*
* @param \Drupal\node\Entity\Node $node
* The node entity to clone.
*
* @return array
* A node submission form.
*/
public function cloneNode(Node $node) {
if (!empty($node)) {
$form = $this
->entityFormBuilder()
->getForm($node, 'quick_node_clone');
return $form;
}
else {
throw new NotFoundHttpException();
}
}
/**
* The _title_callback for the node.add route.
*
* @param \Drupal\node\Entity\Node $node
* The current node.
*
* @return string
* The page title.
*/
public function clonePageTitle(Node $node) {
$prepend_text = "";
$config = \Drupal::config('quick_node_clone.settings');
if (!empty($config
->get('text_to_prepend_to_title'))) {
$prepend_text = $config
->get('text_to_prepend_to_title') . " ";
}
return $prepend_text . $node
->getTitle();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ControllerBase:: |
protected | property | The configuration factory. | |
ControllerBase:: |
protected | property | The current user service. | 1 |
ControllerBase:: |
protected | property | The entity form builder. | |
ControllerBase:: |
protected | property | The entity manager. | |
ControllerBase:: |
protected | property | The entity type manager. | |
ControllerBase:: |
protected | property | The form builder. | 2 |
ControllerBase:: |
protected | property | The key-value storage. | 1 |
ControllerBase:: |
protected | property | The language manager. | 1 |
ControllerBase:: |
protected | property | The module handler. | 2 |
ControllerBase:: |
protected | property | The state service. | |
ControllerBase:: |
protected | function | Returns the requested cache bin. | |
ControllerBase:: |
protected | function | Retrieves a configuration object. | |
ControllerBase:: |
private | function | Returns the service container. | |
ControllerBase:: |
protected | function | Returns the current user. | 1 |
ControllerBase:: |
protected | function | Retrieves the entity manager service. | |
ControllerBase:: |
protected | function | Retrieves the entity type manager. | |
ControllerBase:: |
protected | function | Returns the form builder service. | 2 |
ControllerBase:: |
protected | function | Returns a key/value storage collection. | 1 |
ControllerBase:: |
protected | function | Returns the language manager service. | 1 |
ControllerBase:: |
protected | function | Returns the module handler. | 2 |
ControllerBase:: |
protected | function |
Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait:: |
|
ControllerBase:: |
protected | function | Returns the state storage service. | |
LinkGeneratorTrait:: |
protected | property | The link generator. | 1 |
LinkGeneratorTrait:: |
protected | function | Returns the link generator. | |
LinkGeneratorTrait:: |
protected | function | Renders a link to a route given a route name and its parameters. | |
LinkGeneratorTrait:: |
public | function | Sets the link generator service. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
NodeController:: |
protected | property | The date formatter service. | |
NodeController:: |
protected | property | The entity repository service. | |
NodeController:: |
protected | property | The renderer service. | |
NodeController:: |
public | function | Provides the node submission form. | |
NodeController:: |
public | function | Displays add content links for available content types. | |
NodeController:: |
public | function | The _title_callback for the node.add route. | |
NodeController:: |
protected | function | Gets a list of node revision IDs for a specific node. | |
NodeController:: |
public | function | Generates an overview table of older revisions of a node. | |
NodeController:: |
public | function | Page title callback for a node revision. | |
NodeController:: |
public | function | Displays a node revision. | |
QuickNodeCloneNodeController:: |
protected | property | The entity form builder. | |
QuickNodeCloneNodeController:: |
public | function | Provides the node submission form. | |
QuickNodeCloneNodeController:: |
public | function | The _title_callback for the node.add route. | |
QuickNodeCloneNodeController:: |
public static | function |
Instantiates a new instance of this class. Overrides NodeController:: |
|
QuickNodeCloneNodeController:: |
protected | function |
Retrieves the entity form builder. Overrides ControllerBase:: |
|
QuickNodeCloneNodeController:: |
public | function |
Constructs a NodeController object. Overrides NodeController:: |
|
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |