Loop through an entry's fields and if the field type is "Categories" get that fields value/s In my plugin I need to loop through an entry's fields and if that field is a field type of "Categories" use that entry field value/s. 

This is what I have tried so far.

if(array_key_exists('byCategory', $filterAttributes))
{
  foreach ($entry-&gt;getFieldLayout()-&gt;getFields() as $key) 
  {
      $field = $key-&gt;getField();
      if($field-&gt;type == "Categories"){

         if(!$this-&gt;addFilterdCategories($field,$filterAttributes))
         {
             continue;
         }
      }
   }
}
I believe I have found the answer.

if(array_key_exists('byCategory', $filterAttributes))
{
  foreach ($entry-&gt;getFieldLayout()-&gt;getFields() as $key) 
  {
      $field = $key-&gt;getField();
      if($field-&gt;type == "Categories"){

         if(!$this-&gt;addFilterdCategories($entry[$field-&gt;handle],$filterAttributes))
         {
             continue;
         }
      }
   }
}