Skip to content

Remove View::content property and View::set() method#2073

Merged
mvorisek merged 5 commits intodevelopfrom
drop_content_from_view
Apr 20, 2025
Merged

Remove View::content property and View::set() method#2073
mvorisek merged 5 commits intodevelopfrom
drop_content_from_view

Conversation

@mvorisek
Copy link
Copy Markdown
Member

@mvorisek mvorisek commented Jun 17, 2023

continue #2075 and #2239

View::set method was too abstract and clean override using LSP was not possible.

If View::$content property is needed (and optionally set the data using constructor and/or View::set method), migrate to ViewWithContent class which behaves like the original View.

There were two major usecases for View::$content property / View::set() method:

  • set text data for Content tag
  • set value for form control

@mvorisek mvorisek added the MAJOR label Jun 17, 2023
@mvorisek mvorisek changed the title Drop View::$content/set in favor of ViewWithContent Remove View::$content/set() in favor of ViewWithContent Jun 17, 2023
@mvorisek mvorisek changed the title Remove View::$content/set() in favor of ViewWithContent Remove View::content property (and View::set() method) Jun 17, 2023
@mvorisek mvorisek force-pushed the drop_content_from_view branch 4 times, most recently from 97662f9 to eae3e66 Compare June 18, 2023 19:36
@mvorisek mvorisek force-pushed the drop_content_from_view branch 2 times, most recently from 3ed3857 to 1198841 Compare January 6, 2025 15:39
@mvorisek mvorisek force-pushed the drop_content_from_view branch from d520fe4 to 51fe277 Compare January 15, 2025 08:04
@mvorisek mvorisek force-pushed the drop_content_from_view branch 2 times, most recently from 7f03ecd to 9270290 Compare January 29, 2025 13:15
@mvorisek mvorisek force-pushed the drop_content_from_view branch 2 times, most recently from a65e787 to 714f8e6 Compare April 17, 2025 10:31
@mvorisek mvorisek changed the title Remove View::content property (and View::set() method) Remove View::content property and View::set() method Apr 19, 2025
@mvorisek mvorisek force-pushed the drop_content_from_view branch from 1d3aedd to ad7aff6 Compare April 19, 2025 01:17
@mvorisek mvorisek marked this pull request as ready for review April 19, 2025 13:43
@bedengler
Copy link
Copy Markdown
Contributor

I am using content frequently.
What would it be replaced with?
How can we set the text of a view then? I'm using content, because it can contain html, whereas if we use the \Atk4\Ui\Text element, html will be converted into text.

@mvorisek
Copy link
Copy Markdown
Member Author

In all atk4/ui classes which use content property all works as before.

Bare View class however newly will not contain the content property.

So the question is, if you are using View class directly (with content property) or extend View class in your code (again with content property).

@mkrecek234
Copy link
Copy Markdown
Contributor

I am using View class often for simple views or Fomantic UI elements or fast prototyping of controls saving time to explicitly extend that class.

@mvorisek mvorisek merged commit c914e90 into develop Apr 20, 2025
51 checks passed
@mvorisek mvorisek deleted the drop_content_from_view branch April 20, 2025 16:12
@bedengler
Copy link
Copy Markdown
Contributor

In all atk4/ui classes which use content property all works as before.

Bare View class however newly will not contain the content property.

So the question is, if you are using View class directly (with content property) or extend View class in your code (again with content property).

I am using view directly. What about creating a new extended class named "\Atk4\Ui\Content" which can have the content property?
Btw: I don't get the reason, why it makes sense to remove the content property? What does it make better?

@mvorisek
Copy link
Copy Markdown
Member Author

I am using view directly. What about creating a new extended class named "\Atk4\Ui\Content" which can have the content property?

That is how it is done - the class is named ViewWithContent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants