parent = $form; } /** * @return array|mixed|string|null */ public function key() { if ($this->primaryKey) { return $this->primaryKey; } return $this->parent ? $this->parent->key() : null; } /** * @return string */ public function render() { if ($this->allowOnlyEditing && ! $this->parent->isEditing()) { return ''; } if ($this->allowOnlyCreating && ! $this->parent->isCreating()) { return ''; } return parent::render(); // TODO: Change the autogenerated stub } /** * @return void */ public function setupHtmlAttributes() { $this->addHtmlClass($this->style); parent::setupHtmlAttributes(); } /** * @param mixed ...$params * * @return $this */ public static function allowOnlyCreating(...$params) { $tool = static::make(...$params); $tool->allowOnlyCreating = true; $tool->allowOnlyEditing = false; return $tool; } /** * @param mixed ...$params * * @return $this */ public static function allowOnlyEditing(...$params) { $tool = static::make(...$params); $tool->allowOnlyEditing = true; $tool->allowOnlyCreating = false; return $tool; } }