~xibo-maintainers/xibo/tempel

« back to all changes in this revision

Viewing changes to lib/Entity/Widget.php

  • Committer: Dan Garner
  • Date: 2018-05-21 14:58:11 UTC
  • mfrom: (644.1.8)
  • mto: (614.1.6)
  • mto: This revision was merged to the branch mainline in revision 648.
  • Revision ID: git-v1:e7961b0ebe68a0c0bc5dd7b3abca007138b2cadd
Merge branch 'bugfix/1.8.10-pack1' into feature/r-graph

Show diffs side-by-side

added added

removed removed

Lines of Context:
156
156
     */
157
157
    public $isNew = false;
158
158
 
 
159
    /** @var int[] Original Module Media Ids */
 
160
    private $originalModuleMediaIds = [];
 
161
 
159
162
    /** @var array[int] Original Media IDs */
160
163
    private $originalMediaIds = [];
161
164
 
427
430
 
428
431
    /**
429
432
     * Clear Media
 
433
     *  this must only clear module media, not "primary" media
430
434
     */
431
435
    public function clearCachedMedia()
432
436
    {
433
437
        $this->load();
434
 
        $this->mediaIds = [];
435
 
 
436
 
        // Add back in the audio media id's
437
 
        foreach ($this->audio as $audio) {
438
 
            $this->mediaIds[] = $audio->mediaId;
439
 
        }
 
438
        $this->mediaIds = array_values(array_diff($this->mediaIds, $this->originalModuleMediaIds));
440
439
    }
441
440
 
442
441
    /**
565
564
        // Load any media assignments for this widget
566
565
        $this->mediaIds = $this->widgetMediaFactory->getByWidgetId($this->widgetId);
567
566
        $this->originalMediaIds = $this->mediaIds;
 
567
        $this->originalModuleMediaIds = $this->widgetMediaFactory->getModuleOnlyByWidgetId($this->widgetId);
568
568
 
569
569
        // Load any widget audio assignments
570
570
        $this->audio = $this->widgetAudioFactory->getByWidgetId($this->widgetId);