sfFormPropel::embedRelation PHP Method

embedRelation() public method

Available options: - title: The title of the collection form once embedded. Defaults to the relation name. - decorator: The decorator for the sfWidgetFormSchemaDecorator - add_empty: Whether to allow the user to add new objects to the collection. Defaults to true - empty_label: Label showed to create a new related item. By default is new + name of the relation Additional options are passed to sfFromPropel::getRelationForm()
public embedRelation ( string $relationName, array $options = [] ) : sfPropelForm
$relationName string The name of a relation of the current Model, e.g. 'Book'
$options array An array of options
return sfPropelForm The current form instance
    public function embedRelation($relationName, $options = array())
    {
        $options = array_merge(array('title' => $relationName, 'decorator' => null, 'add_empty' => true, 'max_additions' => 0, 'empty_label' => 'new' . $relationName), $options);
        $relationForm = $this->getRelationForm($relationName, $options);
        $this->addEmptyRelationForm($relationName, $relationForm, 'new' . $relationName, $relationName . '/', $options);
        $this->embedForm($relationName, $relationForm, $options['decorator']);
        $this->widgetSchema->setLabel($relationName, $options['title']);
        return $this;
    }