Problem/Motivation

When you paste a URL in the ‘add media’ dialog for CA3 in the SAAS or PAAS site, the form that displays in the subsequent dialog:

- Ignores any changes you make to the HTML field

Steps to reproduce

- visit node add form
- Click ‘insert media’ on CKEditor
- Switch to CA3 tab
- Paste a fragment URL
- Verify the form displayed in the next step only contains URL, name and HTML
- Edit the HTML
- Verify from admin/content/media that the updated HTML is used. View the entity with e.g. drush and confirm the original_html and latest_html did not get changed

Proposed resolution

File 1: Ca3EmbedForm.php — Line 34
Before:

$instance->set(Ca3MediaFields::HTML, $resource->getHtml());
After:

$instance->set(Ca3MediaFields::HTML, [
'value' => $resource->getHtml(),
'format' => Ca3MediaFields::TEXT_FORMAT,
]);
Sets the text format (ca3_format) along with the HTML value so the field saves correctly without relying on populateFields.

File 2: GovcmsCa3ConsumerHelperHooks.php — Line 170
Before:

$html_fields = [
Ca3MediaFields::HTML,
Ca3MediaFields::LATEST_HTML,
];
After:

$html_fields = [
Ca3MediaFields::LATEST_HTML,
];
Removed Ca3MediaFields::HTML so the presave hook no longer overwrites the user's edited HTML. Only field_latest_html gets set from the oEmbed source.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dhirendra.mishra created an issue. See original summary.

dhirendra.mishra’s picture

Assigned: dhirendra.mishra » Unassigned

supreetam09 made their first commit to this issue’s fork.

supreetam09’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.