  The E1 and M1 contributions to $^7\mathrm{Be}(p,\gamma)^8\mathrm{B}$ at low
energies are calculated in halo effective field theory. The excited
$^7\mathrm{Be}^\star$ core is included as an explicit degree of freedom in a
coupled-channels calculation. The E1 transition is calculated up to
next-to-next-to-leading order. The leading contribution from M1 transition that
gives significant contribution in a narrow energy region around the $1^+$
resonance state of $^8$B is included. We compare our results with previous halo
effective field theory calculations that also included the
$^7\mathrm{Be}^\star$ as an explicit degree of freedom. We disagree with these
previous calculations in both the formal expressions and also in the analysis.
Bayesian inference of the data gives $S_{17}(0)=21.0(7)$ eV b when combined
with the expected theory error.
