protected function addButton($builder, $name, $config)
    {
        $options = isset($config['options']) ? $config['options'] : [];

        if (!in_array($config['type'], $this->allowedTypes)) {
            throw new \LogicException(sprintf(
                'Allowed button types : "%s", given "%s".',
                implode('", "', $this->allowedTypes),
                $config['type']
            ));
        }

        return $builder->add($name, $config['type'], $options);
    }