matminimal.theme 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * @file
  4. * Functions to support theming in the Seven theme.
  5. */
  6. use Drupal\Core\Form\FormStateInterface;
  7. /**
  8. * Implements hook_preprocess_HOOK() for HTML document templates.
  9. */
  10. // function matminimal_preprocess_html(&$variables) {
  11. // // If on a node add or edit page, add a node-layout class.
  12. // $path_args = explode('/', \Drupal::request()->getPathInfo());
  13. // if ($suggestions = theme_get_suggestions($path_args, 'page', '-')) {
  14. // foreach ($suggestions as $suggestion) {
  15. // // dsm($suggestion);
  16. // preg_match('/taxonomy-manage-[^-]+-add$/', $suggestion, $matches);
  17. // // ksm($matches);
  18. // if ($suggestion === 'page--taxonomy-term-edit' || isset($matches)) {
  19. // $variables['attributes']['class'][] = 'node-form-layout';
  20. // }
  21. // }
  22. // }
  23. // }
  24. // function matminimal_form_alter(&$form, FormStateInterface $form_state, $form_id){
  25. // // dsm($form_id);
  26. // // create a colomuned term form (not working yet)
  27. // if(in_array($form_id, ['taxonomy_term_company_form', 'taxonomy_term_showroom_form'])){
  28. // // ksm($form);
  29. // $form['#theme'] = ['term_edit_form'];
  30. // $form['#attached']['library'][] = 'seven/node-form';
  31. //
  32. // $form['advanced']['#type'] = 'container';
  33. // $form['meta']['#type'] = 'container';
  34. // $form['meta']['#access'] = TRUE;
  35. // $form['meta']['changed']['#wrapper_attributes']['class'][] = 'container-inline';
  36. // $form['meta']['author']['#wrapper_attributes']['class'][] = 'container-inline';
  37. //
  38. // $form['revision_information']['#type'] = 'container';
  39. // $form['revision_information']['#group'] = 'meta';
  40. // }
  41. // }
  42. /**
  43. * Implements hook_form_BASE_FORM_ID_alter() for \Drupal\node\NodeForm.
  44. *
  45. * Changes vertical tabs to container.
  46. */
  47. function matminimal_form_node_form_alter(&$form, FormStateInterface $form_state) {
  48. $form['#theme'] = ['node_edit_form'];
  49. $form['#attached']['library'][] = 'seven/node-form';
  50. $form['advanced']['#type'] = 'container';
  51. $form['meta']['#type'] = 'container';
  52. $form['meta']['#access'] = TRUE;
  53. $form['meta']['changed']['#wrapper_attributes']['class'][] = 'container-inline';
  54. $form['meta']['author']['#wrapper_attributes']['class'][] = 'container-inline';
  55. $form['revision_information']['#type'] = 'container';
  56. $form['revision_information']['#group'] = 'meta';
  57. }