Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.74 KB | None | 0 0
  1. $form['cid']['#weight'] = 0.003;
  2. $form['subject']['#weight'] = 0.004;
  3.  
  4. [subject] => Array
  5. (
  6. [#type] => textfield
  7. [#title] => Subject
  8. [#maxlength] => 255
  9. [#required] => 1
  10. [#post] => Array
  11. (
  12. )
  13.  
  14. [#programmed] =>
  15. [#tree] =>
  16. [#parents] => Array
  17. (
  18. [0] => subject
  19. )
  20.  
  21. [#array_parents] => Array
  22. (
  23. [0] => subject
  24. )
  25.  
  26. [#weight] => 0.004
  27. [#processed] => 1
  28. [#description] =>
  29. [#attributes] => Array
  30. (
  31. )
  32.  
  33. [#input] => 1
  34. [#size] => 60
  35. [#autocomplete_path] =>
  36. [#process] => Array
  37. (
  38. [0] => form_expand_ahah
  39. )
  40.  
  41. [#name] => subject
  42. [#id] => edit-subject
  43. [#value] =>
  44. [#defaults_loaded] => 1
  45. [#sorted] => 1
  46. )
  47.  
  48. [cid] => Array
  49. (
  50. [#type] => select
  51. [#title] => Category
  52. [#default_value] => 1
  53. [#options] => Array
  54. (
  55. [1] => General Enquiries
  56. [2] => Support
  57. )
  58.  
  59. [#required] => 1
  60. [#post] => Array
  61. (
  62. )
  63.  
  64. [#programmed] =>
  65. [#tree] =>
  66. [#parents] => Array
  67. (
  68. [0] => cid
  69. )
  70.  
  71. [#array_parents] => Array
  72. (
  73. [0] => cid
  74. )
  75.  
  76. [#weight] => 0.003
  77. [#processed] => 1
  78. [#description] =>
  79. [#attributes] => Array
  80. (
  81. )
  82.  
  83. [#input] => 1
  84. [#size] => 0
  85. [#multiple] =>
  86. [#process] => Array
  87. (
  88. [0] => form_expand_ahah
  89. )
  90.  
  91. [#name] => cid
  92. [#id] => edit-cid
  93. [#value] => 1
  94. [#defaults_loaded] => 1
  95. [#sorted] => 1
  96. )
  97.  
  98. function mymodule_form_alter(&$form, &$form_state, $form_id) {
  99. $form['#pre_render'][] = 'mymodule_form_alter_weight';
  100. }
  101.  
  102. function mymodule_form_alter_weight($elements) {
  103. $elements['cid']['#weight'] = 0.003;
  104. $elements['subject']['#weight'] = 0.004;
  105.  
  106. return $elements;
  107. }
  108.  
  109. function mymodule_content_extra_fields() {
  110. $extras['mymodule'] = array( // Name of field
  111. 'label' => t('Mymodule'),
  112. 'description' => t('Mymodule field'),
  113. 'weight' => 10, // The default weight, can be overriden on Manage Fields
  114. );
  115.  
  116. return $extras;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement