Available fields - AleksandarPredic/psm-fields GitHub Wiki
Available fields
Input text field
/**
* Add input text field
* @param string $name Input field name
* @param string $title Input field title
* @param string $description Field description
* @return $this
*/
public function addInputTextField(
string $name,
string $title,
string $description = ''
)
Textarea field
/**
* Add Textarea field
* @param string $name Textarea field name
* @param string $title Textarea field title
* @param string $description Textarea description
* @return $this
*/
public function addTextareaField(
string $name,
string $title,
string $description = ''
)
WP Editor field
Important: This field is not supported by the Repeater
/**
* Add WP Editor field
* This field is not supported by the Repeater
* @param string $name Editor field name
* @param string $title Editor field title
* @param string $description Editor description
* @return $this
*/
public function addWpEditorField(
string $name,
string $title,
string $description = ''
)
Select field
We can select only one select value. This is not multiselect field.
/**
* Add select field with single selected value
* @param string $name Select field name
* @param string $title Select field title
* @param array $options Array of options in format [value => text, value2 => text2].
* The key will always be converted to string
* @param string $description Field description
* @return $this
*/
public function addSelectField(
string $name,
string $title,
array $options,
string $description = ''
)
Checkbox field
/**
* Add checkbox field with one value. The saved value in db will be string: if checked 1 else 0.
* @param string $name Checkbox field name
* @param string $title Checkbox field title
* @param string $description Checkbox field description
* @return $this
*/
public function addCheckboxField(
string $name,
string $title,
string $description = ''
)
Image uploader field
/**
* Add image uploader field. The image id is saved in post_meta.
* @param string $name Image uploader field name
* @param string $title Image uploader field title
* @param string $description Image uploader description
* @return $this
*/
public function addImageUploaderField(
string $name,
string $title,
string $description = ''
)
Repeater field
/**
* Start accepting new fields and store them as repeater fields
* @param string $name Repeater field name
* @param string $title Repeater field title
* @param string $description Repeater field description
* @return $this
*/
public function startRepeaterField(
string $name,
string $title,
string $description = ''
)
/**
* Stop storing new fields as repeater fields
* @return $this
*/
public function endRepeaterField()