I am working with Magento 2 to get attributes values. Now here I added on an attribute which name Swatch Image. in there I selected 2 options, one I selected hex code (#cdcdcd) and other options I selected Image. Now I know how to get both values using option_id. which are mentioned below. for hex code
$opt_id = 26;
$swatchHelper=$objectManager->get("Magento\Swatches\Helper\Data");
$attributeOptionIds = array($opt_id);
$swatches = $swatchHelper->getSwatchesByOptionsId($attributeOptionIds);
echo "<pre>";
print_r($swatches);
echo "</pre>";
if(sizeof($swatches) > 0 ){
echo "<pre>";
print_r($swatches[$opt_id]['value']);
echo "</pre>";
}
and for Image
$opt_id1 = 27;
$swatchHelper_image=$objectManager->get("Magento\Swatches\Helper\Media");
$swatchCollection = $objectManager->create('Magento\Swatches\Model\ResourceModel\Swatch\Collection');
$swatch1 = $swatchCollection->addFieldtoFilter('option_id',$opt_id1);
$item=$swatch1->getFirstItem();
$ThumbImage1 = $swatchHelper_image->getSwatchAttributeImage('swatch_thumb', $item->getValue());
echo "<br>";
print_r($ThumbImage);
here I added code for both which I know already option 26 is hex and 27 is image. but I want to differentialte it. I mean how can I recognize which is hex and which is image.
Please help me.