silverstripe / silverstripe-framework

Silverstripe Framework, the MVC framework that powers Silverstripe CMS
https://www.silverstripe.org
BSD 3-Clause "New" or "Revised" License
719 stars 820 forks source link

FIX HTMLEditorField::setRows with Elemental #11114

Closed sabina-talipova closed 5 months ago

sabina-talipova commented 5 months ago

Description

Additional modification for

Manual testing steps

namespace App\Blocks;

use DNADesign\Elemental\Models\BaseElement; use SilverStripe\Forms\HTMLEditor\HTMLEditorField;

class LinksListBlock extends BaseElement {

private static array $db = [
    'Content' => 'HTMLText',
];

private static string $icon = 'font-icon-block-file-list';

private static string $table_name = 'TestContentBlock';

private static string $singular_name = 'Test Content Block';

private static string $plural_name = 'Test Content Blocks';

private static bool $inline_editable = true;

public function getType(): string
{
    return _t(self::class . '.BlockType', 'Test Content Block');
}

public function getCMSFields()
{
    $fields = parent::getCMSFields();

    $fields->addFieldsToTab(
        'Root.Main',
        [
            HTMLEditorField::create('Content', 'Content')
            ->setRows(3),
        ],
    );

    return $fields;
}

}


- Create new Page and new Blocks Page in CMS.
- Test that all fields have either default `height = 400px;` or custom `height` is `setRows()` method was applied. 
- Test that the content of `HTMLEditorField` was saved. 

## Issues
<!--
  List all issues here that this pull request fixes/resolves.
  If there is no issue already, create a new one! You must link your pull request to at least one issue.
-->
- https://github.com/silverstripe/silverstripe-elemental/issues/1132

## Pull request checklist
<!--
  PLEASE check each of these to ensure you have done everything you need to do!
  If there's something in this list you need help with, please ask so that we can assist you.
-->
- [x] The target branch is correct
    - See [picking the right version](https://docs.silverstripe.org/en/contributing/code/#picking-the-right-version)
- [x] All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    - Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
- [x] The commit messages follow our [commit message guidelines](https://docs.silverstripe.org/en/contributing/code/#commit-messages)
- [x] The PR follows our [contribution guidelines](https://docs.silverstripe.org/en/contributing/code/)
- [x] Code changes follow our [coding conventions](https://docs.silverstripe.org/en/contributing/coding_conventions/)
- [x] This change is covered with tests (or tests aren't necessary for this change)
- [x] Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
- [x] CI is green
GuySartorelli commented 5 months ago

You didn't tick

This change is covered with tests (or tests aren't necessary for this change)

Does this mean you think you should add tests?