harvs1789uk

The 'Media from Web' modal for embeding video, whould issues with this be a SilverStripe issue, or a TinyMCE one?

More specifically, the markup which is generated by filling out these fields and clicking 'Insert media'

harvs1789uk

https://www.silverstripe.org/learn/lessons/v4/introduction-to-modeladmin-1

function searchableFields() {} which returns the array format I listed originally seems like what I must have been thinking of

Show 1 attachment(s)
silverstripe.org  
SilverStripe Lessons » Introduction to ModelAdmin

In this lesson, we'll create the Property object that will drive most of the content in our application, and add a management interface for it in the CMS using ModelAdmin.

Hide attachment content
harvs1789uk

i.e.

  1. public function getSearchContext() {
  2. $context = parent::getSearchContext();
  3. $fields = $context->getFields();
  4. $fields->replaceField(
  5. "q[Status]",
  6. DropdownField::create("q[Status]")
  7. ->setTitle("Status")
  8. ->setEmptyString("- Select One -")
  9. ->setSource(
  10. Order::$statuses
  11. )
  12. );
  13. }
harvs1789uk

Perhaps I should be looking at ModelAdmin::getSearchContext() and overloading the default search fields there?

harvs1789uk

Or did that never exist and I am mixing it up with something like

  1. GridFieldEditableColumns::setDisplayFields(
  2. 'Number' => array(
  3. 'title' => 'Number',
  4. 'field' => 'LiteralField'
  5. ),
  6. 'Title' => array(
  7. 'title' => 'Title',
  8. 'field' => 'LiteralField'
  9. ),
  10. 'Notes' => array(
  11. 'title' => 'Notes',
  12. 'callback' => function($record, $column, $grid) {
  13. $field = new TextareaField($column);
  14. $field->setRows(2);
  15. return $field;
  16. }
  17. )
  18. )
  19. );
harvs1789uk

That doesn't seem to be documented any more though and I get the below when trying to /dev/build, has this functionality been removed, or am I just doing it wrong?

>>>Fatal error: Constant expression contains invalid operations

harvs1789uk

$searchable_fields (docs - https://docs.silverstripe.org/en/4/developer_guides/model/scaffolding/#searchable-fields) I am sure it used to be possible to pass a callback function (which built and returned a FormField) when using the array notation, i.e. something like:

  1. private static $searchable_fields = [
  2. 'Title',
  3. 'Type' => [
  4. 'title' => 'Type',
  5. 'field' => function() {
  6. return DropdownField::create('Type')
  7. ->setSource(static::$types);
  8. }
  9. ]
  10. ];
harvs1789uk

Ah, I suspect it is showing me draft objects because I am logged in as admin right...

harvs1789uk

Wait...I am not even using getComponents() 🤦 I have this:

  1. $list = CreativeWork::get()
  2. ->sort([
  3. 'Created' => 'DESC',
  4. 'ID' => 'ASC'
  5. ]);