Skip to content

Commit

Permalink
Move inline container style definition to farm_ui_theme.
Browse files Browse the repository at this point in the history
  • Loading branch information
mstenta committed Apr 1, 2023
1 parent 7b3639e commit 5ada077
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
4 changes: 0 additions & 4 deletions modules/core/quick/farm_quick.libraries.yml

This file was deleted.

3 changes: 0 additions & 3 deletions modules/core/quick/src/Form/QuickForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ public function buildForm(array $form, FormStateInterface $form_state, $id = NUL
];
}

// Attach quick form CSS/JS.
$form['#attached']['library'][] = 'farm_quick/quick';

return $form;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.inline {
form.quick-form .inline-container {
display: flex;
flex-wrap: wrap;
column-gap: 2em;
Expand Down
4 changes: 4 additions & 0 deletions modules/core/ui/theme/farm_ui_theme.libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ map:
css/map.css: { }
dependencies:
- farm_map/farm_map
quick:
css:
theme:
css/quick.css: { }
toolbar:
css:
theme:
Expand Down
8 changes: 8 additions & 0 deletions modules/core/ui/theme/farm_ui_theme.module
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

use Drupal\Core\Block\BlockPluginInterface;
use Drupal\Core\Form\FormStateInterface;

/**
* Implements hook_theme().
Expand All @@ -30,6 +31,13 @@ function farm_ui_theme_element_info_alter(array &$info) {
}
}

/**
* Implements hook_form_BASE_FORM_ID_alter().
*/
function farm_ui_theme_form_quick_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$form['#attached']['library'][] = 'farm_ui_theme/quick';
}

/**
* Implements hook_preprocess_HOOK().
*/
Expand Down
2 changes: 1 addition & 1 deletion modules/quick/planting/src/Plugin/QuickForm/Planting.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ protected function buildLogForm(string $log_type, array $include_fields = [], ar
'quantity' => [
'#type' => 'container',
'#attributes' => [
'class' => ['inline'],
'class' => ['inline-container'],
],
'value' => [
'#type' => 'textfield',
Expand Down

0 comments on commit 5ada077

Please sign in to comment.