Until now I've been using standalone to produce cropped figures which are included with \includegraphics command in beamer presentations and articles (beamerarticle) compiled from same source file. Today I wanted to use standalone's possibility of also creating figures and not only including them but as soon as I include ignorenonframetext option for beamer class something breaks. I've read about beamer option for standalone.cls but i don't draw 'animated' figures so I think I don't need it.
Next you have a minimal working and not working example: it works with
\documentclass{article}
\usepackage{beamerarticle}
or
\documentclass{beamer}
but not if \documentclass[ignorenonframetext]{beamer} combines with \input{figure}. If instead of \input I place TiKZ code inside the frame works again even with ignorenonframetext.
%\documentclass{article}
%\usepackage{beamerarticle}
%\documentclass{beamer}
\documentclass[ignorenonframetext]{beamer}
\usepackage{filecontents}
\usepackage{tikz}
\usepackage{standalone}
\begin{filecontents}{figure.tex}
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw(0,0) rectangle (3,5);
\end{tikzpicture}
\end{document}
\end{filecontents}
\begin{document}
\begin{frame}[fragile]{Hello}
\input{figure}
\end{frame}
\end{document}
The error message says:
! LaTeX Error: Can be used only in preamble.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.5 \documentclass
[tikz]{standalone}
? e
Some final comments. I've used filecontents package to simplify the example, real figure files are independent one's. I don't know if frame option fragile is necessary or not. I've also tested with \mode<all> before \input as is suggested in \input{...} is ignored with beamer option ignorenonframetext but nothing changes.
Update
Although egreg answer is valid for the MWE, this was too minimal because as soon as a second nesting level is introduced, \sainput fails. Next you have a new not so minimal working example. In this case, main document \input a file which \input the standalone figure. Everything works with article+beamerarticle or beamer, but not with \documentclass[ignorenonframetext]{beamer}. In this last case, pdflatex finishes and *.log doesn't show any error except No pages of output. and resulting *.pdf has 0 size.
%\documentclass{article}
%\usepackage{beamerarticle}
%\documentclass[ignorenonframetext]{beamer}
\documentclass{beamer}
\usepackage{standalone}
\usepackage{tikz}
\usepackage{filecontents}
\makeatletter
\def\sainput{\let\documentclass\sa@documentclass\input}
\makeatother
\begin{filecontents}{figure.tex}
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw(0,0) rectangle (3,5);
\end{tikzpicture}
\end{document}
\end{filecontents}
\begin{filecontents}{doc.tex}
\begin{frame}{This is a frame}
Here, there is a TiKZ figure
\input{figure}
\end{frame}
\end{filecontents}
\begin{document}
\input{doc}
\end{document}