public function apply($transformer, $audible, $node) { $audio = Audio::create(); // Builds the image $url = $this->getProperty(self::PROPERTY_AUDIO_URL, $node); $title = $this->getProperty(self::PROPERTY_AUDIO_TITLE, $node); $autoplay = $this->getProperty(self::PROPERTY_AUDIO_AUTOPLAY, $node); $muted = $this->getProperty(self::PROPERTY_AUDIO_MUTED, $node); if ($url) { $audio->withURL($url); $audible->withAudio($audio); } else { // URL is a required field for Audio $transformer->addWarning(new InvalidSelector(self::PROPERTY_AUDIO_URL, $audible, $node, $this)); } if ($title) { $audio->withTitle($title); } if ($autoplay === "" || $autoplay === "true" || $autoplay === "autoplay") { $audio->enableAutoplay(); } if ($muted === "" || $muted === "true" || $muted === "muted") { $audio->enableMuted(); } return $audible; }