% This cbx file does not supply a stand-alone type. Rather, these functions are separated in order to simplify maintenance of the main mla-strict.cbx file, since the MLA Handbook no longer advises on ways to style full bibliographic information in the footnote. To use MLA-style footnotes, please set your style to "mla" or "mla-strict" and add the option "autocite=footnote".
\ProvidesFile{mla-footnotes.cbx}[2022/02/22 v2.1a biblatex citation style]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%% Format Declarations %%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\@ifpackagelater{biblatex}{2016/03/01}{%
  \DeclareNameFormat{cite:foot:editor}{%
    \nameparts{#1}%
    \usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\partnamesuffix}%
    \usebibmacro{name:andothers}}%
  \DeclareNameFormat{cite:foot:translator}{%
    \nameparts{#1}%
    \usebibmacro{name:given-family}{\namepartfamily}{\namepartgiven}{\namepartprefix}{\partnamesuffix}%
    \usebibmacro{name:andothers}}%
}{%
  \DeclareNameFormat{cite:foot:editor}{%
    \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
    \usebibmacro{name:andothers}}%
  \DeclareNameFormat{cite:foot:translator}{%
    \usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
    \usebibmacro{name:andothers}}%
}%
\DeclareFieldFormat{foot:cite:edition:format}{%
  \ifinteger{#1}%
    {\mkbibordinal{#1}~\bibstring{edition}}%
    {\printtext[mla:lowercase]{#1}}}
\DeclareFieldFormat{supptotitle}%
  {\bibstring{supptotitle}\addspace\mkbibemph{#1}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% Footnote Definitions %%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newbibmacro*{cite:mla:foot}{%
  \ifciteseen%
    {\usebibmacro{cite:mla:seen}}%
    {\ifbool{cbx@nofullfootnote}%
      {\usebibmacro{cite:mla:seen}}%
      {\usedriver{}{footcite:\strfield{entrytype}}}%
    }}

\newbibmacro*{cite:foot:name}{%
  \global\boolfalse{cbx@named}%
    \usebibmacro{cite:foot:author/editor}%
    \savefield{namehash}{\cbx@lasthash}}%

\newbibmacro*{cite:foot:author:review}{%
  \global\boolfalse{cbx@named}%
  \ifnameundef{author}%
    {}%
    {\usebibmacro{cite:foot:author}%
      \savefield{namehash}{\cbx@lasthash}%
      \global\booltrue{cbx@named}%
    }}%

\newbibmacro*{cite:foot:author/editor}%
{\ifthenelse{\ifuseauthor\AND\NOT\ifnameundef{author}}%
  {\usebibmacro{cite:foot:author}}%
  {\usebibmacro{cite:foot:editor}}}%

\newbibmacro*{cite:foot:author}{%
  \ifbool{bbx@totalnames}%
    {\printnames[byauthor][-\value{listtotal}]{author}}%
    {\printnames[byauthor]{author}}%
  \clearname{author}\global\booltrue{cbx@named}%
  \printfield{nameaddon}}

\newbibmacro*{cite:foot:editor}{%
  \ifthenelse{\ifuseeditor\AND\NOT\ifnameundef{editor}}%
    {\ifbool{bbx@totalnames}%
       {\printnames[byeditor][[-\value{listtotal}]]{editor}}%
       {\printnames[byeditor]{editor}}%
     \setunit*{\addcomma\space}%
     \usebibmacro{editorstrg}%
     \clearname{editor}\global\booltrue{cbx@named}}%
    {\ifusetranslator%
       {\printnames[byeditor]{translator}%
        \setunit*{\addcomma\space}%
        \usebibmacro{translatorstrg}%
        \clearname{translator}\global\booltrue{cbx@named}}%
       {}%
    }}%

\newbibmacro*{cite:foot:byauthor:incollection}{%
  \ifthenelse{\ifuseauthor\OR%
              \ifnameundef{author}\OR%
              \ifnamesequal{author}{bookauthor}}%
    {}%
    {\biblcstring{byauthor}\addspace%
     \printnames[byauthor]{author}}}

\newbibmacro*{cite:foot:byauthor}{%
  \ifthenelse{\ifuseauthor\OR%
              \ifnameundef{author}}%
    {}%
    {\bibstring{byauthor}\addspace\printnames[byauthor]{author}}}

\newbibmacro*{cite:foot:bybookauthor}{%
  \ifthenelse{\ifnameundef{bookauthor}\OR%
      \(\ifnamesequal{author}{bookauthor}\AND\ifuseauthor\)\OR%
	  \iffieldequalstr{entrytype}{inbook}}%
    {}%
    {\bibstring{byauthor}\addspace\printnames[byauthor]{bookauthor}}}

\DeclareBibliographyDriver{footcite:booklet}{%
  \usedriver{}{footcite:book}}
  
\DeclareBibliographyDriver{footcite:mvbook}{%
  \usedriver{}{footcite:book}}

\DeclareBibliographyDriver{footcite:collection}{%
  \usedriver{}{footcite:book}}

\DeclareBibliographyDriver{footcite:reference}{%
  \usedriver{}{footcite:book}}

\DeclareBibliographyDriver{footcite:book}{%
  \usebibmacro{cite:foot:name}%
  \ifbool{cbx@named}% 0.7.1
    {\setunit{\newunitpunct}}%
    {\setunit{}}%
  \usebibmacro{cite:foot:title}%
  \newunit%
  \usebibmacro{cite:foot:byauthor}%
  \newunit%
  \usebibmacro{cite:foot:byeditor}%
  \newunit%
  \usebibmacro{cite:foot:bytranslator}%
  \newunit%
  \printfield{edition}%
  \newunit%
  \iffieldundef{maintitle}%
    {\printfield{volume}%
     \printfield{part}}%
    {}%
  \newunit%
  \printfield{volumes}%
  \newunit%
  \usebibmacro{series+number}%
  \setunit{\addspace}%
  \usebibmacro{cite:foot:publisher+location+year}}

\newbibmacro*{cite:foot:publisher+location+year}{%
  \printtext[parens]{%
      \printfield[noformat]{origyear}%
      \setunit*{\addsemicolon\addspace}%
      \printlist{location}%
      \iflistundef{publisher}%
        {\setunit*{\addspace}}%
        {\setunit*{\addcolon\space}}%
      \printlist{publisher}%
      \newunit%
      \printfield{year}}}

\DeclareBibliographyDriver{footcite:article}{%
  \usebibmacro{cite:foot:name}%
  \newunit%
  \usebibmacro{cite:foot:title}%
  \newunit%
  \usebibmacro{cite:foot:byauthor:incollection}%
  \newunit%
  \usebibmacro{cite:foot:bytranslator}%
  \newunit%
  \usebibmacro{journal+issuetitle}%
  \newunit%
  \iffieldundef{url}{}{\usebibmacro{cite:foot:url+urldate}}%
  \setunit{\addcolon\addspace}%
  \iffieldundef{postnote}%
    {\printfield{pages}}%
    {}}%

\newbibmacro*{cite:foot:url+urldate}{%
  \printtext{\biburldatelong}%
  \setunit{\addspace}%
  \printfield{url}}

\DeclareBibliographyDriver{footcite:inreference}{%
  \usedriver{}{footcite:incollection}}

\DeclareBibliographyDriver{footcite:inbook}{%
  \usedriver{}{footcite:incollection}}
  
\DeclareBibliographyDriver{footcite:incollection}{%
  \usebibmacro{cite:foot:name}%
  \ifbool{cbx@named}% 0.7.1
    {\setunit{\newunitpunct}}%
    {\setunit{}}%
  \ifthenelse{%
    \iffieldequalstr{entrysubtype}{book}%
    \OR%
    \iffieldequalstr{entrysubtype}{play}}%
      {\usebibmacro{cite:foot:title:incollection:italics}}%
      {\usebibmacro{cite:foot:title}}%
  \newunit%
  \printfield[mla:lowercase]{titleaddon}%
  \newunit%
  \usebibmacro{cite:foot:byauthor:incollection}%
  \newunit%
  \ifbool{bbx@uniquetranslator}%
    {\usebibmacro{cite:foot:bytranslator}\clearname{translator}}%
    {}%
  \ifthenelse{%
    \iffieldequalstr{entrysubtype}{book}%
    \OR%
    \iffieldequalstr{entrysubtype}{play}}%
      {\setunit{\addcomma\addspace\bibstring{in}\addspace}}%
      {\newunit}%
  \printtext[citetitle:book]{%
    \printfield[noformat]{booktitle}%
    \setunit{\subtitlepunct}%
    \printfield[noformat]{booksubtitle}%
  }%
  \usebibmacro{cite:foot:bybookauthor}%
  \newunit%
  \usebibmacro{cite:foot:byeditor}%
  \newunit%
  \iffieldsequal{year}{edition}%
    {\printfield{year}~\bibstring{edition}\clearfield{year}}%
    {\printfield[foot:cite:edition:format]{edition}\isdot}%
  \newunit%
  \iffieldundef{maintitle}%
    {\printfield{volume}%
     \printfield{part}}%
    {}%
  \newunit%
  \printfield{volumes}%
  \newunit%
  \usebibmacro{series+number}%
  \setunit{\addspace}%
  \iffieldundef{year}%
      {}%
      {\usebibmacro{cite:foot:publisher+location+year}}%
  \setunit{\addspace}%
  \iffieldundef{postnote}%
    {\printfield{pages}}%
    {}%
  }%

\DeclareBibliographyDriver{footcite:phdthesis}{%
  \usedriver{}{footcite:thesis}}

\DeclareBibliographyDriver{footcite:thesis}{%
  \usebibmacro{cite:foot:name}%
  \newunit%
  \usebibmacro{title}%
  \newunit%
  \ifbibstring{\thefield{type}}%
      {\printtext[default]{\bibstring{\thefield{type}}}}%
      {\printtext[default]{\printfield{type}}}%
  \newunit%
  \printlist{institution}%
  \newunit%
  \iffieldequalstr{entrysubtype}{published}%
    {\printfield{origyear}\clearfield{origyear}}%
    {\printfield{year}}%
  \newunit%
  \iffieldequalstr{entrysubtype}{published}%
    {\usebibmacro{series+number}%
      \setunit{\addspace}%
      \usebibmacro{cite:foot:publisher+location+year}}%
    {}}

\DeclareBibliographyDriver{footcite:review}{%
  \usebibmacro{cite:foot:author:review}%
  \ifbool{cbx@named}%
    {\setunit{\newunitpunct}}%
    {\setunit{}}%
  \usebibmacro{cite:foot:title}%
  \setunit*{\newunitpunct}%
  \printtext[bibhyperref]%
    {\bibstring{reviewof}\addspace\printfield{booktitle}}%
  \newunit%
  \ifnameundef{bookauthor}%
    {\printtext[reviewededitor]{\printnames[default]{editor}}}%
    {\printtext[reviewedauthor]{\printnames[default]{bookauthor}}}%
  \newunit%
  \usebibmacro{journal+issuetitle}%
  \newunit%
  \iffieldundef{url}{}{\usebibmacro{cite:foot:url+urldate}}%
  \setunit{\addcolon\addspace}%
  \iffieldundef{postnote}%
    {\printfield{pages}}%
    {}}%

\DeclareBibliographyDriver{footcite:video}{%
  \setbool{cbx@named}{false}%
  \ifnamesequal{labelname}{author}%
    {\usebibmacro{mla:video:name:first:footnote}{author}%
     \setbool{cbx@named}{true}}%
    {}%
  \ifnamesequal{labelname}{editor}%
    {\usebibmacro{mla:video:name:first:footnote}{editor}%
     \setbool{cbx@named}{true}}%
    {}%
  \ifbool{cbx@named}%
    {\setunit{\newunitpunct}}%
    {\setunit{}}%
  \printtext[bibhyperref]{\printfield{title}}%
  \newunit%
  \ifnameundef{bookauthor}%
    {}%
    {\printtext[reviewedauthor]{\printnames[byeditor]{bookauthor}}}%
  \newunit%
  \usebibmacro{mla:video:name:second:footnote}{author}%
  \newunit%
  \usebibmacro{mla:video:name:second:footnote}{editor}%
  \newunit%
  \usebibmacro{mla:video:name:second:footnote}{namea}%
  \newunit%
  \usebibmacro{mla:video:name:second:footnote}{nameb}%
  \newunit%
  \usebibmacro{mla:video:name:second:footnote}{namec}%
  \newunit%
  \printfield{origyear}%
  \newunit%
  \printfield{howpublished}%
  \newunit%
  \printlist{publisher}%
  \newunit%
  \printfield{year}%
  \addperiod}

\DeclareBibliographyDriver{footcite:suppcollection}{%
  \usedriver{}{footcite:suppbook}}

\DeclareBibliographyDriver{footcite:suppbook}{%
  \usebibmacro{cite:foot:name}%
  \newunit%
  \usebibmacro{cite:foot:title}%
  \newunit%
  \printfield{entrysubtype}%
  \newunit%
  \usebibmacro{booktitle}%
  \setunit{\newunitpunct\bibstring{bytypeauthor}\addspace}%
  \ifnamesequal{labelname}{bookauthor}%
    {\printnames[mla:last]{bookauthor}}%
    {\printnames[byauthor]{bookauthor}}%
  \newunit%
  \usebibmacro{byeditor+others}%
  \newunit%
  \printfield{edition}%
  \newunit%
  \iffieldundef{maintitle}%
    {\printfield{volume}%
     \printfield{part}}%
    {}%
  \newunit%
  \printfield{volumes}%
  \newunit%
  \usebibmacro{series+number}%
  \setunit{\addspace}%
  \usebibmacro{cite:foot:publisher+location+year}%
  \setunit{\addspace}%
  \iffieldundef{postnote}%
    {\printfield{pages}}%
    {}}

\DeclareBibliographyDriver{footcite:unpublished}{%
  \usebibmacro{cite:foot:name}%
  \newunit%
  \usebibmacro{mla:title:unpublished}%
  \newunit%
  \newunit%
  \printfield{note}%
  \newunit%
  \usebibmacro{mla:all:type:foot}%
  \setunit*{\isdot\addspace}%
  \printfield{number}%
  \newunit%
  \printfield{library}%
  \setunit{\addcomma\addspace}%
  \printlist{location}%
  \newunit%
  \printfield{addendum}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{footcite:periodical}{%
  \usebibmacro{cite:foot:editor}%
  \setunit{\labelnamepunct}\newblock%
  \usebibmacro{mla:article:journal+issuetitle}%
  \newunit\newblock
  \printfield{note}%
  \setunit{\addcolon\addspace}\newblock
  \iffieldundef{postnote}%
    {\printfield{pages}}%
    {}%
  \newunit\newblock
  \usebibmacro{url+urldate}%
  \newunit\newblock
  \printfield{addendum}%
  \newunit\newblock
  \usebibmacro{pageref}%
  \usebibmacro{finentry}}

\newbibmacro*{cite:foot:title}{%
  \iffieldundef{title}%
    {}%
    {\printtext[bibhyperref]{%
    \printtext[citetitle:\strfield{entrytype}]{%
      \printfield[noformat]{title}%
      \setunit{\subtitlepunct}%
      \printfield[noformat]{subtitle}}}%
    }}%

\newbibmacro*{cite:foot:title:incollection:italics}{%
  \printtext[bibhyperref]{%
    \printtext[title:book]{%
      \printfield[noformat]{title}%
      \setunit{\subtitlepunct}%
      \printfield[noformat]{subtitle}}%
  }}%

\newbibmacro*{cite:foot:bytranslator}{%
  \ifnameundef{translator}%
    {}%
    {\printtext[default]{\bibstring{bytranslator}\addspace%
      \printnames[cite:foot:translator]{translator}}}}

\newbibmacro*{cite:foot:byeditor}{%
  \ifthenelse{\ifnameundef{editor}\OR%
     \( \iffieldequalstr{entrytype}{collection}\AND%
       \ifnameundef{author} \)}%
    {}%
    {\usebibmacro{byeditor+others}}}

\newbibmacro*{mla:foot:postnote}{%
  \iffieldundef{postnote}%
    {\unspace}%
    {\unspace\addspace\printfield[footpostnote]{postnote}}%
  \usebibmacro{cite:reset}}

\endinput