$view
$view : \Dewdrop\View\View
The view that instantiated this helper.
Render a row inside the WP admin's edit form table.
This helper can leverage information from a \Dewdrop\Db\Field object to set it's options prior to rendering.
Example usage:
echo $this->wpEditRow()->open($this->fields->get('model:field_name')); echo $this->wpInputText($this->fields->get('model:field_name')); echo $this->wpEditRow()->close();
$view : \Dewdrop\View\View
The view that instantiated this helper.
__construct(\Dewdrop\View\View $view)
Create helper, accepting a reference to the related view object
\Dewdrop\View\View | $view |
partial(string $name, array $data) : string
Render a partial view script.
Generally, your helper should render HTML with partial view scripts rather than generating the markup in the helper class directly. This makes it easier for frontend developers to make modifications to the HTML.
The $data parameter should contain key-value pairs for each variable you'd like available in your partial view.
string | $name | |
array | $data |
The rendered output
closeField(\Dewdrop\Db\Field $field) : string
Use the supplied field to render the closing tags. The field's note will be used, if it is set.
\Dewdrop\Db\Field | $field |
delegateIfArgsProvided(array $args, string $method = 'directWithArgs') : $this|string
Useful in cases where you want to just return the helper if the user didn't provide any args to direct(), but want to call a short-cut method if they did.
array | $args | |
string | $method |
delegateByArgs(array $args, string $methodPrefix) : mixed
Delegate to one of three methods depending upon the contents of the $args array:
array | $args | The arguments to pass the delegated method. |
string | $methodPrefix |
checkRequired(array $options, array $required) : \Dewdrop\View\Helper\AbstractHelper
Check that the values in $required are present as keys in $options.
Use this in methods accepting parameters as an array of key-value pairs to ensure that required parameters are present. If one of the required parameters is absent, an exception is thrown.
array | $options | |
array | $required |
ensurePresent(array $options, array $present) : \Dewdrop\View\Helper\AbstractHelper
Ensure that the values in $present are keys in $options.
If the key is absent from $options, it will be added with a null value. Therefore, this method differs from checkRequired() in that the user must supply a value (even if that value is null) before checkRequired(), but for ensurePresent() the key will simply be added if the user hadn't already specified a value.
Note: Notice that the $options parameter is handled by-reference to allow creation of the missing keys while still allowing chaining to other methods.
array | $options | |
array | $present |
ensureArray(array $options, array $isArray) : \Dewdrop\View\Helper\AbstractHelper
Ensure that the values in the $isArray parameter are present in $options as an array.
If the option's current value is null, it will be converted to an array. If the option's current value is not null but also not an array, it will be wrapped in an array. For example, if you had a "classes" option that let the user specify one or more CSS classes, they could use a string to define a single class and this method would wrap that single value in array array to make the handling of the various options simpler and more consistent for the view helper developer.
Note: Notice that the $options parameter is handled by-reference to allow creation of the missing keys while still allowing chaining to other methods.
array | $options | |
array | $isArray |
openField(\Dewdrop\Db\Field $field) : string
Open the edit row using a \Dewdrop\Db\Field object to determine the label text and the value of the "for" attribute on the label tag.
\Dewdrop\Db\Field | $field |
openArray(array $options) : string
Open the edit row using an array of key-value pairs to assign the options.
If the labelFor option is null, no label tag will be rendering, instead rendering the label text unadorned. This is useful and necessary to emulate the WordPress style of rendering checkboxes with a plain-text label in the left-hand column and then an actual label tag in the right-hand column with the "for" assigned to the checkbox node.
array | $options |