$coming_from_page
$coming_from_page : integer
The page id of the page the user is coming from
Class for the ready to publish form.
$environment : \O3PO_Environment
Environment
__construct(string $plugin_name, string $slug, \O3PO_Environment $environment, \O3PO_Ready2PublishStorage $storage)
Construct this form
string | $plugin_name | Name of the plugin |
string | $slug | Slug of this form |
\O3PO_Environment | $environment | Environment in which the form operates |
\O3PO_Ready2PublishStorage | $storage | Storage used by the form |
do_parse_request(boolean $bool, \WP $wp, boolean $do_not_exit = False)
Parse form requests
Processes form input and displays the form.
boolean | $bool | Whether or not to parse the request. |
\WP | $wp | Current WordPress environment instance. |
boolean | $do_not_exit | Whether to exit after parsing the request. Can be set to false for testing only. |
on_submit(array $attach_ids) : boolean
On submit
Executed on form submission. Stores the information in the storage and sends various emails.
array | $attach_ids | Id of attachments created during form submission. |
Whether this step of form submission was successful.
specify_page(string $id, string $title, callable $callback = null)
Specify a section of the form.
Keeps a record of all sections in $this->sections.
string | $id | Slug-name to identify the page. |
string | $title | Formatted title of the section. Shown as the heading for the section. |
callable | $callback | Function that echos out the any content at the top of the page (before the first section). |
specify_section(string $id, string $title, callable $callback, string $page, callable $summary_callback = null)
Specify a section of the form.
Keeps a record of all sections in $this->sections.
string | $id | Slug-name to identify the section. Used in the 'id' attribute of tags. |
string | $title | Formatted title of the section. Shown as the heading for the section. |
callable | $callback | Function that echos out any content at the top of the section (between heading and fields). |
string | $page | The slug-name of the page on which to show the section. |
callable | $summary_callback | Callback to call when composing the summary of this form. |
specify_field(string $id, string $title, callable $callback, string $page, string $section, array $args, callable $validation_callable, string $default, integer $max_length = false)
Specify a field of the form.
Keeps a record of all fields in $this->fields.
string | $id | Slug-name to identify the field. Used in the 'id' attribute of tags. |
string | $title | Formatted title of the field. Shown as the heading for the field. |
callable | $callback | Function that echos out any content at the top of the field (between heading and fields). |
string | $page | The slug-name of the page on which to show the field. |
string | $section | The slug-name of the section in which to show the field. |
array | $args | { Extra arguments used when outputting the field. May be an empty array().
} |
callable | $validation_callable | Callable to use during validation of inputs. Must take a field ID and input as parameters and return a valid value for the field. Should call $this->add_error() to indicate problems. |
string | $default | Default value for the field. |
integer | $max_length | Maximum length of the value of the field. |
render_single_line_field(string $id, string|null $placeholder = null, string $autocomplete = 'on', string $style = false, string $label = false, boolean $esc_label = true, string $label_style = false)
Render a standard text box type field.
string | $id | Id of the field. |
string|null | $placeholder | Placeholder text (default is null). |
string | $autocomplete | Whether to auto complete 'or' (default) or 'off. |
string | $style | CSS style. |
string | $label | HTML label. |
boolean | $esc_label | Whether to escape the content of label. |
string | $label_style | CSS style for the label. |
render_multi_line_field(string $id, integer $rows = false, string $style = false, boolean $preview = false, string $placeholder = false)
Render a multi line text box type field.
string | $id | Id of the field. |
integer | $rows | Number of rows |
string | $style | CSS style |
boolean | $preview | Whether to show a LaTeX preview below the field. |
string | $placeholder | Placeholder |
render_checkbox_field(string $id, string $label = '', boolean $esc_label = true)
Render a checkbox type field.
string | $id | Id of the field. |
string | $label | Label of the field. |
boolean | $esc_label | Whether to escape the content of $label, disable in case you want $label to contains htmls |
render_array_as_comma_separated_list_field(string $id, string $placeholder = null)
Render an array as comma separated list type field.
Does not escape or otherwise handle individual fields that contain commas.
string | $id | Id of the field. |
string | $placeholder | Placeholder text. |
specify_fake_field(string $id, string $default)
Add a fake field
Fake fields cannot be modified, but have default values that can be used to avoid hard coding values.
string | $id | Slug-name to identify the section. Used in the 'id' attribute of tags. |
string | $default | Default value for the field. |
specify_settings(\O3PO_Settings $settings)
Specify the settings of this form
Should be overwritten by classes implementing this interface. In this function classes can specify their settings fields by calling $settings->specify_field().
\O3PO_Settings | $settings | Settings instance |
validate_featured_image_upload(string $id, array $file_of_this_id) : array
Validate the feature image upload
string | $id | Id of the image upload field |
array | $file_of_this_id | Array with fields such as those of a single element of the $_FILE variable |
Various image upload information
validate_eprint_fetch_meta_data_check_license_and_store_in_session(string $id, string $input) : string
Validate the license and fetch and store meta-data from the arXiv
string | $id | Id of the field |
string | $input | The input |
The eprint
add_error(string $setting, string $code, string $message, $type = 'error')
Record errors during input verification.
The O3PO_Settings class for example implements this as just a wrappter around add_settings_error().
Implementations must adhere to the following parameter specification:
string | $setting | Slug title of the setting to which this error applies. |
string | $code | Slug-name to identify the error. Used as part of 'id' attribute in HTML output. |
string | $message | The formatted message text to display to the user (will be shown inside styled and tags). |
$type | Message type, controls HTML class. Possible values include 'error', 'success', 'warning', 'info'. Default value: 'error' |
get_session_data(string $field, mixed $default = Null, string $session_id = Null)
Get field from the data of a session
string | $field | The field to get. |
mixed | $default | The default value in case the field is not set. |
string | $session_id | The session id for which to get the field. |