- Issue created by @marcus_johansson
 - Merge request !514Issue #3505711: Use image fields from media entity reference in CKEditor → (Open) created by Unnamed author
 - 🇮🇳India anjaliprasannan
Added Media entity reference to add image in ckeditor
SS: - 🇬🇧United Kingdom MrDaleSmith
Can you add some steps to recreate the issue; i can't work out what set up I need to carry out to test this patch.
 - 🇮🇳India anjaliprasannan
Prerequisites:
- Ensure the Media Library and Media modules are enabled.
 - Create an AI Automator Chain Type with a Media Entity Reference Field as the input field.
 - Enable this AI Automator Chain Type in AI Tools under CKEditor plugin settings.
 - Select the Media Entity Reference Field as the input field in the AI Tools settings.
 - Enable the Media Library plugin in CKEditor.
 
Test Steps:
Edit a Content Entity:- Navigate to a content entity with a CKEditor field.
 - Open the editor for the CKEditor-enabled field.
 
Add an Image via Media Library Plugin:
- Click the Media Library button in CKEditor.
 - Select an existing image or upload a new image.
 - Insert the image into the CKEditor field.
 
Trigger AI Assistant Plugin:
- Select the inserted image in CKEditor.
 - Click on the AI Assistant Plugin that was configured.
 
Expected Result:
- The AI Assistant Plugin processes the selected image.
 - The image is fetched and rendered correctly in the Media Entity Reference Field.
 
 - 🇬🇧United Kingdom MrDaleSmith
OK, I'm going to have to leave this one: code looks good but I clearly don't know enough about the automator chains to properly set up a test.
 - 🇮🇳India anjaliprasannan
Detailed steps:
- Navigate to /admin/config/ai/automator_chain_types and click on Add Automator Chain Types to create an ai automator chain type.
 - Name the automator chain type: Generate Alt Text from Image.
 - Save the chain type and edit it to add fields.
 
- Input field: An image field (required) named Input Image.
 - Output field: A text field named Image Alt Text.
 - Formatted long text field: A field named Output Image with Alt Text to store the generated result.
 
Configuring the AI Automator for the fields:
- Enable AI Automator for Image Alt Text
 - Edit Image Alt Text and check Enable AI Automator.
 - Change Automator Input Mode to Advanced Mode (Token).
 - In Automator Prompt (Token), add the following prompt:
 - Check Edit when changed.
 - Set Automator Worker to Direct - Processes and saves the value directly.
 - Select AI Provider as OpenAI.
 - Save the settings.
 
Generate an alt text for the input image in less than 5 words. Input image: [automator_chain:field_input_image]Enable AI Automator for Output Image with Alt Text
- Edit Output Image with Alt Text and check Enable AI Automator.
 - Change Automator Input Mode to Advanced Mode (Token).
 - Add the following Automator Prompt (Token):
 - Check Edit when changed.
 - Set Automator Weight to 110 (so it runs after Image Alt Text automator).
 - Select AI Provider as OpenAI.
 - Set Use text format to Basic HTML.
 - Save the settings.
 
Generate the output in the below format : <img src="[automator_chain:field_input_image:entity:url]" data-entity-uuid="[automator_chain:field_input_image:entity:uuid]" alt="[automator_chain:field_image_alt_text]">
Enabling AI Automator in CKEditor- Navigate to /admin/config/content/formats and configure the text format (e.g., Basic HTML).
 - Add AI CKEditor to the Active Toolbar.
 - In CKEditor 5 plugin settings, open the AI Tools section.
 - Open AI Automator CKEditor and enable AI Automators.
 - Enable Generate Alt Text from Image settings and select:
 - Input field: Input Image
 - Text Selection Input: Input Image
 - Require Selection: Checked (ensures selected image is used as input).
 - Write Mode: Replace (generated output replaces selected input).
 - Output field: Output Image with Alt Text
 
Testing the AI Automator Chain Type
- Create article content.
 - In the CKEditor field, add an image.
 - Select the image and click on the AI Assistant plugin.
 - Click on Generate Alt Text from Image to open the AI Assistant modal.
 - The selected image appears in the upload field.
 - Click Generate and wait for AI to process the image.
 - Once done, the generated alt text appears in the response field.
 - Click Save changes to editor and verify the image has the new alt text.
 
 - 🇬🇧United Kingdom MrDaleSmith
It's probably me, but following those instructions I just get the standard image upload field not the image I chose for the final step. I think I will let someone more familiar with the automators test this because I can't confirm the change is working.
 - Status changed to Needs review
4 months ago 2:31pm 17 July 2025 - 🇩🇪Germany marcus_johansson
Merged and upped to 1.2.x - could someone test it?