private function tr($basePath, $data, $options = []) { if ($this->readonly) { $options['readonly'] = true; } $options = Hash::merge(Hash::merge($this->formOptions, $options), ['tftag' => 'td', 'tag' => 'tr', 'url' => Hash::extract($this->options, 'url')]); $form = new InlineForm($this->Html, $data, $this->model, $options); $is_first = true; return $form->create() . implode(array_map(function ($field) use($basePath, $form, &$is_first) { if ($is_first && !$this->readonly) { $button = '<button onclick="return false;" class="btn btn-danger btn-xs if-delete pull-right"><span class="glyphicon glyphicon-remove"></span></button>'; $is_first = false; } else { $button = ''; } $path = $field['path']; $spath = explode('.', $path); $options = $field['options']; $options['data-field'] = end($spath); return $this->Html->tag('td', $button . $form->control($path, $options)); }, $this->fields)) . $form->writePrimaryKey(['tag' => 'td']) . $form->end(); }