Row Specs
It is often convenient to define a row spec as its own class so that it can be included in multiple places. These are usually kept in App\Crud\Rows\ but you can put them wherever you like. There is also a php artisan make:flexrow command, which will create a RowSpec class and blank template for you.
Rowspecs can then be added/edited/removed for any FlexibleContentField using the addRowSpec, addRowSpecs, addRowSpecAfter, addRowSpecsAfter, addRowSpecBefore, addRowSpecsBefore, appendRowSpec, extractRowSpec, getRowSpec, getRowSpecs, hasRowSpec, moveRowSpecAfter, moveRowSpecBefore, prependRowSpec, removeRowSpec functions.
The constructor should be used to set up fields on the row spec or to maniplate existing fields if you are extending an existing row spec
public function __construct(string $name = 'main')
{
parent::__construct($name);
$this->setLabel('Simple Button')->addFields([
(new TextField('url'))
->addFieldsetClass('is-half'),
(new TextField('label'))
->addFieldsetClass('is-half'),
]);
}
Excerpt
The title bar of a row will show the name of the Row Spec. It will also show the row's "excerpt" to make it easier to identify rows, especially when they are collapsed.
The exceprt will show the contents of the title field or the name field if either exist on the row. If neither exist you can provide the name of another TextField or WYSIWYGField to use instead.
FlexibleContentSection::make('text')
->addFields([
WysiwygField::make('content'),
])
->excerptField('content')