This solved a problem I had. I thought it might help others.

I asked AI: In Backdrop CMS, I have enabled image uploading for the CKEditor 5 in the "Body" section of a content type where the text format designated is for use by non-admin authenticated users. The problem is I do not want non-admin authenticated users to be able to "Select from Library," yet that option appears to non-admin authenticated users. I only want them to be able to upload files. I also have a separate image field that is part of the content type in question and it has a setting to enable or not enable the image browser. How do I get the "Select from Library" option removed from the image upload screen so it won't show up for non-admin authenticated users?

AI said: To hide the library option conditionally based on the content type or user role, you can use a preprocess hook in your active theme's template.php file to inject a targeted CSS stylesheet or inline script only when that specific form is viewed by non-admin users.

Add the following code snippet to your theme's template.php file:

/**
* Implements hook_form_BASE_FORM_ID_alter() for node_form.
*/
function YOUR_THEME_NAME_form_node_form_alter(&$form, &$form_state, $form_id) {
 // Target the permaculture_spotlight content type form
 if (isset($form['#node']) && $form['#node']->type == 'permaculture_spotlight') {
   // Check if the current user is not an administrator
   if (!user_has_role('administrator')) {
     // Attach a custom CSS file to hide the library button
     $form['#attached']['css'][] = backdrop_get_path('theme', 'YOUR_THEME_NAME') . '/css/hide-editor-library.css';
   }
 }
}

Make sure to replace YOUR_THEME_NAME in both places with your actual active theme's machine name (e.g., basis or whatever your custom theme is named).

Then, create a small CSS file in your theme's css/ directory named hide-editor-library.css containing:

CSS
.editor-image-library,
.editor-image-toggle:nth-child(2) {
 display: none !important;
}