/** * Provide a row that can be linked to all the fields from the supplied * table. If the field has a value, we'll look up the row using the table's * find() method. Otherwise, we'll create a new row. Note that an exception * is throw if you attempt to use this linker with a field that doesn't * itself have a row associated with it already. Often you'll link to the * first row using a \Dewdrop\Fields\RowEditor\Link\QueryString rule and * then string Field linker on after that. * * @throws \Dewdrop\Fields\Exception * @param Table $table * @return \Dewdrop\Db\Row */ public function link(Table $table) { if (!$this->field->hasRow()) { $this->field->setRow($this->rowEditor->getRow($this->field->getGroupName())); } $value = $this->field->getValue(); if ($value) { $row = $table->find($value); } else { $row = $table->createRow(); } return $row; }
/** * Use the supplied \Dewdrop\Db\Field object to set the helper's options * and then render the input. * * @param Field $field * @param array $options * @return string */ protected function directField(Field $field, array $options = array()) { $fieldDefaults = array('name' => $field->getControlName(), 'id' => $field->getHtmlId(), 'value' => $field->getValue()); return $this->directArray($fieldDefaults + $options); }
public function direct(Field $field, Field $cascadeFrom) { $this->view->headScript()->appendFile($this->view->bowerUrl('/dewdrop/www/js/cascade-select.js')); return $this->view->select(['name' => $field->getControlName(), 'id' => $field->getHtmlId(), 'options' => [], 'value' => $field->getValue(), 'attributes' => ['data-cascade-options' => $this->view->encodeJsonHtmlSafe($field->getOptionGroups()->fetchJsonWrapper()), 'data-cascade-from' => '#' . $cascadeFrom->getHtmlId(), 'data-cascade-title' => "Choose a {$cascadeFrom->getLabel()}...", 'data-show-blank' => true, 'data-blank-title' => '', 'data-value' => $field->getValue()]]); }
/** * Render the image picker using the supplied Field object. * * @param Field $field * @return string */ public function directField(Field $field) { return $this->directArray(array('name' => $field->getControlName(), 'id' => $field->getHtmlId(), 'value' => $field->getValue())); }
public function isDeleted() { return $this->hasDeleteField() && $this->deleteField->getValue(); }
/** * Use a \Dewdrop\Db\Field object to set the editor's id and content. * * @param Field $field * @return string */ public function directField(Field $field) { $field->getFilterChain()->attach(new StripSlashes()); return $this->directArray(array('name' => $field->getControlName(), 'value' => $field->getValue(), 'id' => $field->getHtmlId())); }