function renderPageSizeField($args) { if (!isset($this->options['pdf_page_size'])) { if (isset($this->options['pdf_page_width']) && isset($this->options['pdf_page_height'])) { if ('5.5in' == $this->options['pdf_page_width'] && '8.5in' == $this->options['pdf_page_height']) { $this->options['pdf_page_size'] = 1; } elseif ('6in' == $this->options['pdf_page_width'] && '9in' == $this->options['pdf_page_height']) { $this->options['pdf_page_size'] = 2; } elseif ('8.5in' == $this->options['pdf_page_width'] && '11in' == $this->options['pdf_page_height']) { $this->options['pdf_page_size'] = 3; } elseif ('8.5in' == $this->options['pdf_page_width'] && '9.25in' == $this->options['pdf_page_height']) { $this->options['pdf_page_size'] = 4; } elseif ('5in' == $this->options['pdf_page_width'] && '7.75in' == $this->options['pdf_page_height']) { $this->options['pdf_page_size'] = 5; } elseif ('4.25in' == $this->options['pdf_page_width'] && '7in' == $this->options['pdf_page_height']) { $this->options['pdf_page_size'] = 6; } elseif ('21cm' == $this->options['pdf_page_width'] && '29.7cm' == $this->options['pdf_page_height']) { $this->options['pdf_page_size'] = 7; } elseif ('14.8cm' == $this->options['pdf_page_width'] && '21cm' == $this->options['pdf_page_height']) { $this->options['pdf_page_size'] = 8; } elseif ('5in' == $this->options['pdf_page_width'] && '8in' == $this->options['pdf_page_height']) { $this->options['pdf_page_size'] = 9; } else { $this->options['pdf_page_size'] = 10; } } else { $this->options['pdf_page_size'] = 1; } } $html = "<select name='pressbooks_theme_options_pdf[pdf_page_size]' id='pdf_page_size' >"; foreach ($args as $key => $val) { $html .= "<option value='" . ($key + 1) . "' " . selected($key + 1, $this->options['pdf_page_size'], false) . ">{$val}</option>"; } $html .= '<select>'; echo $html; }