/** * Filter the property before its assigned to the object row. * * This method is useful for classes using this trait. * * @param ModelInterface $object The current row's object. * @param PropertyInterface $property The current property. * @param string $propertyValue The property $key's display value. * @return array */ protected function parsePropertyCell(ModelInterface $object, PropertyInterface $property, $propertyValue) { unset($object); return ['ident' => $property->ident(), 'val' => trim($propertyValue)]; }
/** * Get a CLI password input (hidden) from a password property. * * @param PropertyInterface $prop The property to retrieve input from. * @return \League\CLImate\TerminalObject\Dynamic\Input */ private function passwordInput(PropertyInterface $prop) { $climate = $this->climate(); $input = $climate->password(sprintf('Enter value for "%s":', $prop->label())); return $input; }
/** * Filter the table cell's CSS classes before the property is assigned * to the object row. * * This method is useful for classes using this trait. * * @param PropertyInterface $property The current property. * @param ModelInterface|null $object Optional. The current row's object. * @return array */ protected function parsePropertyCellClasses(PropertyInterface $property, ModelInterface $object = null) { unset($object); $ident = $property->ident(); $classes = [sprintf('property-%s', $ident)]; $options = $this->viewOptions($ident); if (isset($options['classes'])) { if (is_array($options['classes'])) { $classes = array_merge($classes, $options['classes']); } else { $classes[] = $options['classes']; } } return $classes; }