}
+ /**
+ * @param $id
+ * @param null $default
+ * @return string|null
+ */
+ public function getHrefByID($id, $default = null)
+ {
+ $item = $this->findOneById($id);
+
+ if ($item) {
+ return $item->getHref();
+ }
+
+ return $default;
+ }
+
+
/**
* @param string $href
*/
return $default;
}
+ /**
+ * @param string $collectionID Name of the collection
+ * @param string $conversionName
+ * @param mixed $default
+ * @return string|null
+ */
+ public function getImageURLbyCollection($collectionID, $conversionName = '', $default = null)
+ {
+ $media = $this->getEntity()->getMedia($collectionID);
+ if (!$media) {
+ return $default;
+ }
+
+ foreach ($media as $m) {
+ /** @var Media $m */
+ $res = $m->getUrl($conversionName);
+ if (!$res) {
+ continue;
+ }
+ return $res;
+ }
+
+ return $default;
+ }
+
public function getImageURLAt($offset, $at = 0, $conversionName = '', $default = null)
{
$media = $this->getMedia($offset);