The bynder compact views allows to add additional filters, to prefilter the assets on the search view.
It's currently possible to alter the entity browser form widget, but not to adjust the filters itself on the bynder view e.g. with:
/**
* Hook for hook_form_entity_browser_form_alter.
*/
#[Hook('form_entity_browser_form_alter')]
public function formEntityBrowserFormAlter(array &$form, FormStateInterface $form_state, $form_id): void {
if (strpos($form_id, 'entity_browser_') === 0 && !empty($form['widget']['#attached']['drupalSettings']['bynder'])) {
// add some custom filters here...
$form['widget']['#attached']['drupalSettings']['bynder']['additionalFilters'] = [
'assetFilter' => [
'predefinedMetapropertiesOptions' => [
'Asset_usage' => [
'Free_for_use' => '262C882E-4378-4E5F-AC17B0F0EFF946F1',
],
],
'showToolbar' => TRUE,
'predefinedAssetType' => array_map('strtoupper', $form['widget']['#attached']['drupalSettings']['bynder']['types']),
],
];
}
}
issue is that the bynder.search_view.js is currently fixed related to the filters properties - no change to add some custom filter.
idea would be to simply merge the bynder compact view to allow adding custom filters
// Get custom config if available
const customConfig = drupalSettings.bynder?.additionalFilters || {};
// Merge configurations
const finalConfig = {
...baseConfig,
...customConfig
}
BynderCompactView.open(finalConfig);
Active
4.3
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.