Programmatically set class on extended field type Earlier I created an extended version of the Node class. I called it AbleNode and it extended BaseNode. In order to set all nodes to this node type I added this to my custom .module file

function ablecore_entity_type_build(&amp;$entity_types){
    if(isset($entity_types['node'])){
        $entity_types['node']-&gt;setClass('Drupal\ablecore\Plugin\Node\AbleNode');
    }
}


This works fine but I'm not sure how to do this with an extended field type. Here is the code for my field class that is extending the BaseFileFieldItemList class

&lt;?php
namespace Drupal\ablecore\Plugin\Field\FieldType\FileFieldItemList;
/**
 * @file AbleNode.php
 */
use Drupal\file\Plugin\Field\FieldType\FileFieldItemList as BaseFileFieldItemList;

class AbleFileFieldItemList extends BaseFileFieldItemList {
    public function style($image_style) {
        $image_style = \Drupal\image\Entity\ImageStyle::load($image_style);
        if (!empty($image_style)) {
            return $image_style-&gt;buildUrl($this-&gt;getEntity()-&gt;getFileuri());
        } else {
            return false;
        }
    }
}


I see how I was able to turn all nodes into AbleNodes, but I'm not sure how to make all FileFieldItemLists into AbleFileFieldItemLists. Is there a hook I can use to setClass on the field whenever I encounter it? Keep in mind that I'm not trying to create a brand new field, I just want to give more functionality to existing field types.
This is untested, but I'm pretty sure you just need to change the list class for the field types using hook_field_info_alter():

function ablecore_field_info_alter(&amp;$info) {
  foreach ($info as &amp;$field) {
    if ($field['list_class'] == '\Drupal\file\Plugin\Field\FieldType\FileFieldItemList') {
      $field['list_class'] = '\Drupal\ablecore\Plugin\Field\FieldType\AbleFileFieldItemList';
    }
  }
}