batch of improvement from quantin's feedback
This commit is contained in:
65
web/themes/custom/matminimal/matminimal.theme
Normal file
65
web/themes/custom/matminimal/matminimal.theme
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Functions to support theming in the Seven theme.
|
||||
*/
|
||||
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_preprocess_HOOK() for HTML document templates.
|
||||
*/
|
||||
// function matminimal_preprocess_html(&$variables) {
|
||||
// // If on a node add or edit page, add a node-layout class.
|
||||
// $path_args = explode('/', \Drupal::request()->getPathInfo());
|
||||
// if ($suggestions = theme_get_suggestions($path_args, 'page', '-')) {
|
||||
// foreach ($suggestions as $suggestion) {
|
||||
// // dsm($suggestion);
|
||||
// preg_match('/taxonomy-manage-[^-]+-add$/', $suggestion, $matches);
|
||||
// // ksm($matches);
|
||||
// if ($suggestion === 'page--taxonomy-term-edit' || isset($matches)) {
|
||||
// $variables['attributes']['class'][] = 'node-form-layout';
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// function matminimal_form_alter(&$form, FormStateInterface $form_state, $form_id){
|
||||
// // dsm($form_id);
|
||||
// // create a colomuned term form (not working yet)
|
||||
// if(in_array($form_id, ['taxonomy_term_company_form', 'taxonomy_term_showroom_form'])){
|
||||
// // ksm($form);
|
||||
// $form['#theme'] = ['term_edit_form'];
|
||||
// $form['#attached']['library'][] = 'seven/node-form';
|
||||
//
|
||||
// $form['advanced']['#type'] = 'container';
|
||||
// $form['meta']['#type'] = 'container';
|
||||
// $form['meta']['#access'] = TRUE;
|
||||
// $form['meta']['changed']['#wrapper_attributes']['class'][] = 'container-inline';
|
||||
// $form['meta']['author']['#wrapper_attributes']['class'][] = 'container-inline';
|
||||
//
|
||||
// $form['revision_information']['#type'] = 'container';
|
||||
// $form['revision_information']['#group'] = 'meta';
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Implements hook_form_BASE_FORM_ID_alter() for \Drupal\node\NodeForm.
|
||||
*
|
||||
* Changes vertical tabs to container.
|
||||
*/
|
||||
function matminimal_form_node_form_alter(&$form, FormStateInterface $form_state) {
|
||||
$form['#theme'] = ['node_edit_form'];
|
||||
$form['#attached']['library'][] = 'seven/node-form';
|
||||
|
||||
$form['advanced']['#type'] = 'container';
|
||||
$form['meta']['#type'] = 'container';
|
||||
$form['meta']['#access'] = TRUE;
|
||||
$form['meta']['changed']['#wrapper_attributes']['class'][] = 'container-inline';
|
||||
$form['meta']['author']['#wrapper_attributes']['class'][] = 'container-inline';
|
||||
|
||||
$form['revision_information']['#type'] = 'container';
|
||||
$form['revision_information']['#group'] = 'meta';
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
{#
|
||||
/**
|
||||
* @file
|
||||
* Theme override for a node edit form.
|
||||
*
|
||||
* Two column template for the node add/edit form.
|
||||
*
|
||||
* This template will be used when a node edit form specifies 'node_edit_form'
|
||||
* as its #theme callback. Otherwise, by default, node add/edit forms will be
|
||||
* themed by form.html.twig.
|
||||
*
|
||||
* Available variables:
|
||||
* - form: The node add/edit form.
|
||||
*
|
||||
* @see seven_form_node_form_alter()
|
||||
*/
|
||||
#}
|
||||
|
||||
<div class="layout-node-form clearfix">
|
||||
<div class="layout-region layout-region-node-main">
|
||||
{{ form|without('advanced', 'footer', 'actions', 'group_internal') }}
|
||||
</div>
|
||||
<div class="layout-region layout-region-node-secondary">
|
||||
{{ form.group_internal }}
|
||||
{{ form.advanced }}
|
||||
{{ form.actions }}
|
||||
</div>
|
||||
<div class="layout-region layout-region-node-footer">
|
||||
<div class="layout-region-node-footer__content">
|
||||
{{ form.footer }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user