Repository navigation
Expand file tree
/
Copy pathentity_browser_block_layout.module
More file actions
88 lines (78 loc) · 2.96 KB
/
Copy pathentity_browser_block_layout.module
File metadata and controls
88 lines (78 loc) · 2.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
/**
* @file
* Contains entity_browser_block_layout.module.
*/
use Drupal\entity_browser_block_layout\FormAlter;
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_form_FORM_ID_alter().
*
* Add a label to the node date operator so you can tell what value it's for.
*/
function entity_browser_block_layout_form_views_exposed_form_alter(&$form, FormStateInterface $form_state, $form_id) {
$view_ids = ['node_browser'];
$view = $form_state->getStorage('view');
if (in_array($view['view']->id(), $view_ids)) {
$form['created_op']['#title'] = t('Post date');
}
}
/**
* Implements hook_form_FORM_ID_alter() for layout_builder_update_block().
*/
function entity_browser_block_layout_form_layout_builder_update_block_alter(&$form, FormStateInterface $form_state, $form_id) {
\Drupal::classResolver(FormAlter::class)
->alterLayoutBuilderUpdateBlockForm($form, $form_state, $form_id);
}
/**
* Implements hook_form_FORM_ID_alter() for layout_builder_add_block().
*/
function entity_browser_block_layout_form_layout_builder_add_block_alter(&$form, FormStateInterface $form_state, $form_id) {
\Drupal::classResolver(FormAlter::class)
->alterLayoutBuilderAddBlockForm($form, $form_state, $form_id);
}
/**
* Implements hook_form_FORM_ID_alter() for node_type_edit_form().
*/
function entity_browser_block_layout_form_node_type_edit_form_alter(&$form, FormStateInterface $form_state, $form_id) {
\Drupal::classResolver(FormAlter::class)
->alterEntityTypeForm('node', $form, $form_state, $form_id);
}
/**
* Implements hook_form_FORM_ID_alter() for node_type_add_form().
*/
function entity_browser_block_layout_form_node_type_add_form_alter(&$form, FormStateInterface $form_state, $form_id) {
\Drupal::classResolver(FormAlter::class)
->alterEntityTypeForm('node', $form, $form_state, $form_id);
}
/**
* Implements hook_form_FORM_ID_alter() for node_type_edit_form().
*/
function entity_browser_block_layout_form_media_type_edit_form_alter(&$form, FormStateInterface $form_state, $form_id) {
\Drupal::classResolver(FormAlter::class)
->alterEntityTypeForm('media', $form, $form_state, $form_id);
}
/**
* Implements hook_form_FORM_ID_alter() for node_type_add_form().
*/
function entity_browser_block_layout_form_media_type_add_form_alter(&$form, FormStateInterface $form_state, $form_id) {
\Drupal::classResolver(FormAlter::class)
->alterEntityTypeForm('media', $form, $form_state, $form_id);
}
/**
* Implements hook_preprocess_views_view().
*
* Adds css and js to entity browser views that will highlight the selected
* row and make the whole row clickable, not just the checkbox.
*/
function entity_browser_block_layout_preprocess_views_view(&$variables) {
$affected_views = [
'node_browser',
'block_browser',
'media_entity_browser',
'bio_browser',
];
if (in_array($variables['view']->id(), $affected_views)) {
$variables['view_array']['#attached']['library'][] = 'entity_browser_block_layout/eb_view_decoration';
}
}