WPML_Package class
This class is declared in PLUGIN_FOLDER/inc/compatibility-packages/wpml-package.class. It’s an abstract class so it shouldn’t be instantiated but extended by the compatibility packages. Its main properties are:
- $name – the name of package as given by the folder it sits in
- $type – the type of the package (for built in packages this can be themes or plugins)
- $settings – the package settings
- $data – the package meta information as defined in the packages load.php file
These properties are set to each object that will be instantiated from a class that extends WPML_Package.
Other calls (not yet implemented)
- filter_home_link
- tbd
- language_selector_header
- tbd
- language_selector_footer
- tbd
- add_post_available
- tbd
- check_widget
- tbd
Methods for this class
add_option_checkbox »
Description
Adds a checkbox in WPML’s language menu for on/off theme language options.
Arguments
- [string] $wpml_page – the WPML admin page it applies to (e.g. PLUGIN_FOLDER/menu/languages.php)
- [string] $option_label – description of the option that will show up on the generated form
- [string] $option_name – the option name that will be saved to database and be accessible through the settings property
- [string] $group_name – on each page there can be more groups of options (different forms) that are generated by packages. This will set the group that this option will belong to. (default: ‘Extra options’) – [optional]
- [string] $default_value – default value of the option (e.g. ‘checked’)- [optional]
- [array] $extra_attributes – extra attributes for the <input> tag (e.g. array(‘class’=>’some_fancy_class’))- [optional]
add_option_text »
Arguments
- [string] $wpml_page – the WPML admin page it applies to (e.g. PLUGIN_FOLDER/menu/languages.php)
- [string] $option_label – description of the option that will show up on the generated form
- [string] $option_name – the option name that will be saved to database and be accessible through the settings property
- [string] $group_name – on each page there can be more groups of options (different forms) that are generated by packages. This will set the group that this option will belong to. (default: ‘Extra options’) – [optional]
- [string] $default_value – default value of the option (e.g. ‘checked’)- [optional]
- [array] $extra_attributes – extra attributes for the <input> tag (e.g. array(‘class’=>’some_fancy_class’))- [optional]
add_option_textarea »
Arguments
- [string] $wpml_page – the WPML admin page it applies to (e.g. PLUGIN_FOLDER/menu/languages.php)
- [string] $option_label – description of the option that will show up on the generated form
- [string] $option_name – the option name that will be saved to database and be accessible through the settings property
- [string] $group_name – on each page there can be more groups of options (different forms) that are generated by packages. This will set the group that this option will belong to. (default: ‘Extra options’) – [optional]
- [string] $default_value – default value of the option (e.g. ‘checked’)- [optional]
- [array] $extra_attributes – extra attributes for the <input> tag (e.g. array(‘class’=>’some_fancy_class’))- [optional]
add_option_radio »
Description
Adds a radio box to WPML’s language menu for multiple options theme language options.
Arguments
- [string] $wpml_page – the WPML admin page it applies to (e.g. PLUGIN_FOLDER/menu/languages.php)
- [string] $option_label – description of the option that will show up on the generated form
- [string] $option_name – the option name that will be saved to database and be accessible through the settings property
- [array] $option_options – array of options (e.g. array(‘0′=>’No’, ‘1′=>’Yes’))
- [string] $group_name – on each page there can be more groups of options (different forms) that are generated by packages. This will set the group that this option will belong to. (default: ‘Extra options’) – [optional]
- [string] $default_value – default value of the option (e.g. ‘checked’)- [optional]
- [array] $extra_attributes – extra attributes for the <input> tag (e.g. array(‘class’=>’some_fancy_class’))- [optional]
add_option_select »
Arguments
- [string] $wpml_page – the WPML admin page it applies to (e.g. PLUGIN_FOLDER/menu/languages.php)
- [string] $option_label – description of the option that will show up on the generated form
- [string] $option_name – the option name that will be saved to database and be accessible through the settings property
- [array] $option_options – array of options (e.g. array(‘0′=>’–Select color”, ‘red’=>’Red’, ‘yellow’=>’Yellow’))
- [string] $group_name – on each page there can be more groups of options (different forms) that are generated by packages. This will set the group that this option will belong to. (default: ‘Extra options’) – [optional]
- [string] $default_value – default value of the option (e.g. ‘checked’)- [optional]
- [array] $extra_attributes – extra attributes for the <input> tag (e.g. array(‘class’=>’some_fancy_class’))- [optional]
add_options »
Description
Adds an option in WPML’s language menu for theme language options.
Arguments
- [string] $wpml_page – the WPML admin page it applies to (e.g. PLUGIN_FOLDER/menu/languages.php)
- [array] $options_array – array of options
e.g.array( 'some-option' => array( 'option_type' => 'checkbox', 'option_name' => 'some-option', 'option_label' => 'Enable this feature', 'values' => array(), 'default_value' => 'checked' ), 'some-other-option' => array( 'option_type' => 'text', 'option_name' => 'some-other-option', 'option_label' => 'Enter a value', 'values' => array(), 'default_value' => 'some value' ), 'some-radio-option' => array( 'option_type' => 'radio', 'option_name' => 'some-radio-option', 'option_label' => 'Select your option', 'values' => array('yes'=>'Yes', 'no'=>'No way'), 'default_value' => 'no' ) ) - [string] $group_name
load_css »
Arguments
[string] $file – $file path, relative to the package root folderContinue reading
load_js »
Arguments
[string] $file – $file path, relative to the package root folderContinue reading
English