Problem/Motivation

Steps to reproduce:

  • Install brightcove module
  • Install inline entity form
  • Create a reference field from videos to brightcove entities
  • Use IEF for that field as widget
  • Note: You could also try to use brightcove together with the media module.

Problem

IEF doesn't use form classes but rather just leverages entity form displays, therefore any logic encoded inside the custom form classes of the brightcove module don't work.
One obvious example is the default reference ID.

Proposed resolution

Let's use a default value callback for it instead.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#4 2731915-4.patch3.76 KBdawehner
#4 interdiff.txt1.86 KBdawehner
#2 2731915-2.patch4.2 KBdawehner
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner created an issue. See original summary.

dawehner’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
4.2 KB

There we go.

yce’s picture

Status: Needs review » Needs work

Please check you code again, you would prevent the Video upload by adding this condition for BrightcoveVideo::save() method: if (FALSE && $upload) {...}.

Also please use static::class or self::class instead of the get_called_class() method.

dawehner’s picture

Status: Needs work » Needs review
FileSize
1.86 KB
3.76 KB

Thank you for the review!

Also please use static::class or self::class instead of the get_called_class() method.

I always forgot about it, even it is really really nice! Thank you for bringing up this point.

+++ b/src/Entity/BrightcoveVideo.php
@@ -596,7 +596,7 @@ public function save($upload = FALSE) {
     // Upload data for Brightcove only if we saved the video from form.
-    if ($upload) {
+    if (FALSE && $upload) {

Ups, yeah that was just a temporary workaround, damnit, this really should have not landed in the patch.

dawehner’s picture

Friendly ping :)

  • yce committed b4e745a on 8.x-1.x authored by dawehner
    Issue #2731915 by dawehner: Move default reference ID logic from the...
yce’s picture

Status: Needs review » Fixed

Thanks! It's looking good, commited.

yce’s picture

Status: Fixed » Closed (fixed)
dawehner’s picture

Thank you a lot.

@yce
Just a quick comment regarding how to deal with issues. When you just mark something as fixed it appears in the tracker of other people. Once an issue was fixed for 2 weeks it'll be closed automatically. When you set it to closed (fixed) it vanishes directly from the tracker of other people.

yce’s picture

I see, okay, thanks for letting me know!