Gets single content from Bildy.
Please note that to get an instance of this class you should use B::getContent() instead of directly creating a new instance.
Functions
delete
Details...
Deletes the content
Description
Response delete (
void
)
Deletes the content permanently. There is no way to restore the content after this method has been called.
Return Values
Information about the deletion that is usable mostly for the Bildy Editor. You can however use Response::hasErrors() to check if the deletion was successful or not.
get
Details...
Gets a raw value for given field
Description
string get (
string $field
)
Returns a value from the database without passing it through the control's output handling.
If there are multiple sub fields in the control and you need to get them all, you can use B_Content::getControlValues() instead.
To get the value as it would be output through a control, use B_Content::getOutput().
Parameters
- field
- Field name.
Return Values
A field value from the database.
getContentWhere
Details...
Gets a single B_Content that fulfills a condition
Description
static B_Content getContentWhere (
string $datamodel,
mixed $where[,
string $value
= NULL
]
)
If you need an instance of a content that fulfills a condition but you don't necessarily know the path or the id of the content, you can use this method to get the content.
If there are several results for the condition, only first one is returned.
Parameters
- datamodel
- Data model name of the content.
- where
If $where is TRUE, $value is used without filtering as the complete where clause. In this case caller is responsible for making sure the where clause is escaped properly to be safely used in an SQL query.
If $where is an array, its keys are used as fields and values as values in where clause.
In other cases $where is used as key and $value as value. If only $where is given, it used as key and it's checked against NULL value.
- value(optional, default: NULL)
- See description of $where.
Return Values
A B_Content instance.
getControlValues
Details...
Returns all values from database that are related to the given field
Description
array getControlValues (
string $field
)
This method can be used to get all the sub fields of a control for a field as raw values from the database.
By using this method you can effectively create a custom output.php inside a template without need to modify the output.php of the control itself.
You need to use this only for fields that use a control that have multiple sub fields. If the control has only one field with empty suffix, you may also use B_Content::get().
Parameters
- field
- Field name.
Return Values
Array that contains all the sub fields of the control used by given field.
getDatamodel
Details...
Returns data model name of the content
Description
string getDatamodel (
void
)
Returns the data model name of the content. To get a Bildy instance for the data model, use
B::getDatamodel().
Return Values
Name of the content's data model.
getOutput
Details...
Receives the control output for a field
Description
string getOutput (
void
)
Returns output from content's field through the control output.
To get the raw output from the database, use B_Content::get() instead.
Return Values
Field output.
update
Details...
Updates the content
Description
bool update (
array $data
)
Updates the content with data given.
Parameters
- data
- An array with keys as field names and values as field values.
Return Values
TRUE if update was successful, FALSE otherwise.
url
Details...
Returns a URL that can be used in links for the content
Description
string url (
void
)
You can call this method to get a URL that can be used to link to the content.
Return Values
A URL to the content.