Fieldmanager_Field::__construct PHP Method

__construct() public method

It might also die, but only helpfully, to catch errors in development.
public __construct ( string $label = '', array $options = [] )
$label string title of form field
$options array with keys matching vars of the field in use.
    public function __construct($label = '', $options = array())
    {
        $this->set_options($label, $options);
        // A post can only have one parent, so if this saves to post_parent and
        // it's repeatable, we're doing it wrong.
        if ($this->datasource && !empty($this->datasource->save_to_post_parent) && $this->is_repeatable()) {
            _doing_it_wrong('Fieldmanager_Datasource_Post::$save_to_post_parent', __('A post can only have one parent, therefore you cannot store to post_parent in repeatable fields.', 'fieldmanager'), '1.0.0');
            $this->datasource->save_to_post_parent = false;
            $this->datasource->only_save_to_post_parent = false;
        }
    }

Usage Example

 /**
  * Construct default attributes; 50x10 textarea
  * @param string $label
  * @param array $options
  */
 public function __construct($label = '', $options = array())
 {
     $this->attributes = array('cols' => '50', 'rows' => '10');
     // Sanitize the textarea to preserve newlines. Could be overriden.
     $this->sanitize = 'fm_sanitize_textarea';
     parent::__construct($label, $options);
 }
All Usage Examples Of Fieldmanager_Field::__construct