Craft 3 - Programatically get all the values contained in a field of type category I want to programmatically get all the values contained in a field of type category.

I am doing this on Elements::EVENT_AFTER_SAVE_ELEMENT. 

If I dump $event-&gt;element-&gt;getFieldValue('productTheme') I get the field but I did't find how to go from there.

My final goal is to have the categories from the category field in an array (not all the categories in the category group, but only those selected in the field).
Your field contains an object of type ElementQuery in order to get all Categories you'll need to execute it.

$categories = $element-&gt;getfieldValue('productTheme')-&gt;all();
$categoryTitles = [];
for($categories as $category){
    $categoryTitles[] = $category-&gt;title;
}


Please read the documentation