Skip to content

Commit 733f845

Browse files
authored
Merge pull request #1776 from mdupont/footnotes-typo
Fix documentation and method name for FootnoteProperties
2 parents dfea4e1 + cb3e211 commit 733f845

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

docs/elements.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,17 +359,17 @@ The footnote numbering can be controlled by setting the FootnoteProperties on th
359359

360360
.. code-block:: php
361361
362-
$fp = new PhpWord\SimpleType\FootnoteProperties();
362+
$fp = new \PhpOffice\PhpWord\ComplexType\FootnoteProperties();
363363
//sets the position of the footnote (pageBottom (default), beneathText, sectEnd, docEnd)
364-
$fp->setPos(FootnoteProperties::POSITION_DOC_END);
364+
$fp->setPos(\PhpOffice\PhpWord\ComplexType\FootnoteProperties::POSITION_BENEATH_TEXT);
365365
//set the number format to use (decimal (default), upperRoman, upperLetter, ...)
366-
$fp->setNumFmt(FootnoteProperties::NUMBER_FORMAT_LOWER_ROMAN);
366+
$fp->setNumFmt(\PhpOffice\PhpWord\SimpleType\NumberFormat::LOWER_ROMAN);
367367
//force starting at other than 1
368368
$fp->setNumStart(2);
369369
//when to restart counting (continuous (default), eachSect, eachPage)
370-
$fp->setNumRestart(FootnoteProperties::RESTART_NUMBER_EACH_PAGE);
370+
$fp->setNumRestart(\PhpOffice\PhpWord\ComplexType\FootnoteProperties::RESTART_NUMBER_EACH_PAGE);
371371
//And finaly, set it on the Section
372-
$section->setFootnoteProperties($properties);
372+
$section->setFootnoteProperties($fp);
373373
374374
Checkboxes
375375
----------

src/PhpWord/Element/Section.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,18 @@ public function getFooters()
146146
*
147147
* @return FootnoteProperties
148148
*/
149+
public function getFootnoteProperties()
150+
{
151+
return $this->footnoteProperties;
152+
}
153+
154+
/**
155+
* Get the footnote properties
156+
*
157+
* @deprecated Use the `getFootnoteProperties` method instead
158+
*
159+
* @return FootnoteProperties
160+
*/
149161
public function getFootnotePropoperties()
150162
{
151163
return $this->footnoteProperties;

src/PhpWord/Writer/Word2007/Part/Document.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,27 +126,27 @@ private function writeSectionSettings(XMLWriter $xmlWriter, Section $section)
126126
$xmlWriter->endElement();
127127
}
128128

129-
//footnote properties
130-
if ($section->getFootnotePropoperties() !== null) {
129+
// Footnote properties
130+
if ($section->getFootnoteProperties() !== null) {
131131
$xmlWriter->startElement('w:footnotePr');
132-
if ($section->getFootnotePropoperties()->getPos() != null) {
132+
if ($section->getFootnoteProperties()->getPos() != null) {
133133
$xmlWriter->startElement('w:pos');
134-
$xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getPos());
134+
$xmlWriter->writeAttribute('w:val', $section->getFootnoteProperties()->getPos());
135135
$xmlWriter->endElement();
136136
}
137-
if ($section->getFootnotePropoperties()->getNumFmt() != null) {
137+
if ($section->getFootnoteProperties()->getNumFmt() != null) {
138138
$xmlWriter->startElement('w:numFmt');
139-
$xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getNumFmt());
139+
$xmlWriter->writeAttribute('w:val', $section->getFootnoteProperties()->getNumFmt());
140140
$xmlWriter->endElement();
141141
}
142-
if ($section->getFootnotePropoperties()->getNumStart() != null) {
142+
if ($section->getFootnoteProperties()->getNumStart() != null) {
143143
$xmlWriter->startElement('w:numStart');
144-
$xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getNumStart());
144+
$xmlWriter->writeAttribute('w:val', $section->getFootnoteProperties()->getNumStart());
145145
$xmlWriter->endElement();
146146
}
147-
if ($section->getFootnotePropoperties()->getNumRestart() != null) {
147+
if ($section->getFootnoteProperties()->getNumRestart() != null) {
148148
$xmlWriter->startElement('w:numRestart');
149-
$xmlWriter->writeAttribute('w:val', $section->getFootnotePropoperties()->getNumRestart());
149+
$xmlWriter->writeAttribute('w:val', $section->getFootnoteProperties()->getNumRestart());
150150
$xmlWriter->endElement();
151151
}
152152
$xmlWriter->endElement();

0 commit comments

Comments
 (0)