Commit 4f741fb7 authored by akalam's avatar akalam

Added authlink form as node task (yet without functionality)

parent 20528ecd
node_authlink.node_authlink_node_form:
title: 'Authlink'
route_name: node_authlink.node_authlink_node_form
base_route: entity.node.canonical
weight: 10
node_authlink.node_authlink_node_form:
path: 'node/{node}/authlink'
defaults:
_form: '\Drupal\node_authlink\Form\NodeAuthlinkNodeForm'
_title: 'NodeAuthlinkNodeForm'
requirements:
_access: TRUE
options:
_admin_route: FALSE
<?php
namespace Drupal\node_authlink\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
/**
* Class NodeAuthlinkNodeForm.
*/
class NodeAuthlinkNodeForm extends FormBase {
/**
* Drupal\Core\Config\ConfigFactoryInterface definition.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a new NodeAuthlinkNodeForm object.
*/
public function __construct(
ConfigFactoryInterface $config_factory
) {
$this->configFactory = $config_factory;
}
public static function create(ContainerInterface $container) {
return new static(
$container->get('config.factory')
);
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'node_authlink_node_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $node = NULL) {
$form['submit'] = [
'#type' => 'submit',
'#value' => $this->t('Create authlink'),
'#weight' => '0',
];
return $form;
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// Display result.
foreach ($form_state->getValues() as $key => $value) {
drupal_set_message($key . ': ' . $value);
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment