You are here

public function PanelsPaneController::create in Fieldable Panels Panes (FPP) 7

Create a barebones FPP object.

@para array $values A list of values to add to the base object; must contain the key 'bundle' containing the machine name of the FPP bundle/type to be used.

Return value

object An empty object with the expected base fields present.

File

includes/PanelsPaneController.class.php, line 420
Contains the controller class for the Fieldable Panel Pane entity.

Class

PanelsPaneController
Entity controller class.

Code

public function create(array $values) {
  $entity = (object) array(
    'bundle' => $values['bundle'],
    'language' => LANGUAGE_NONE,
    'is_new' => TRUE,
  );

  // Ensure basic fields are defined.
  $values += array(
    'bundle' => 'fieldable_panels_pane',
    'title' => '',
    'link' => '',
    'path' => '',
    'reusable' => FALSE,
    'admin_title' => '',
    'admin_description' => '',
    'category' => '',
    'vid' => '',
    'current_vid' => '',
  );

  // Apply the given values.
  foreach ($values as $key => $value) {
    $entity->{$key} = $value;
  }
  return $entity;
}