Carbon_Fields\Field\Field::get_autoload PHP Method

get_autoload() public method

Return whether or not this value should be auto loaded.
public get_autoload ( ) : boolean
return boolean
    public function get_autoload()
    {
        return $this->autoload;
    }

Usage Example

 /**
  * Save the field value(s) into the database.
  *
  * @param Field $field The field to save.
  */
 public function save(Field $field)
 {
     $name = $field->get_name();
     $autoload = $field->get_autoload() ? 'yes' : 'no';
     // Add value to the cache, so that add_option always works
     $notoptions = wp_cache_get('notoptions', 'options');
     $notoptions[$name] = '';
     wp_cache_set('notoptions', $notoptions, 'options');
     if (!add_option($name, $field->get_value(), null, $autoload)) {
         update_option($name, $field->get_value());
     }
 }