public function setValue($value, $postID = null)
{
// Apply cleaning method for the value (for serialized data, slashes, etc).
$value = $this->cleanValueForSaving($value);
if ($this->type == self::TYPE_ADMIN) {
$this->getFramework()->setInternalAdminPageOption($this->settings['id'], $value);
} else {
if ($this->type == self::TYPE_META) {
if (empty($postID)) {
$postID = $this->owner->postID;
}
// If no $postID is given, try and get it if we are in a loop.
if (empty($postID) && !is_admin() && get_post() != null) {
$postID = get_the_ID();
}
update_post_meta($postID, $this->getID(), $value);
} else {
if ($this->type == self::TYPE_CUSTOMIZER) {
set_theme_mod($this->getID(), $value);
}
}
}
do_action('tf_set_value_' . $this->settings['type'] . '_' . $this->getOptionNamespace(), $value, $postID, $this);
return true;
}