Comments (6)
I've just realised this is a little more complex when you actually want to use $Title as a front-end field. If $Name is meant for CMS use and the $Title is meant for front end, then the GridFieldAddExistingSearchButton needs to use $Name rather than $Title.
Currently you would have to do the following:
$fields->addFieldToTab('Root.Main', new TextField('Title', 'Name (CMS Use Only)'),'ManyMany[BlockArea]');
$fields->addFieldToTab('Root.Main', new TextField('Name', 'Title'),'ManyMany[BlockArea]');
And then use $Name in the front end as though it were $Title...
Pretty horrible :)
from silverstripe-blocks.
Also related to this is that the CMS breadcrumbs do not display the name of the block you are currently on, as they also rely on a $Title field too.
In all honesty, I'm not convinced that the semantic benefits of removing Block::$Title outweigh the complications and issues that it causes elsewhere.
As I understand it all DataObjects should have a $Title field anyway, whether it's used on the front-end or not, otherwise you start getting into issues where it's assumed to exist.
from silverstripe-blocks.
Hi Aram, Shea,
I'm the one responsible for changing the Title to Name, with the reasoning
as described. I haven't noticed the necessity for a Title field because I
added a fallback getTitle while developing, like you did. For obvious
reasons this didn't make it into the merged version.
However, I'd vote against just adding back the title field, as it's a wrong
assumption that all blocks necessarily need a title. For
GridFieldAddExistingSearchButton, we'd better make a Fix/PR adding
functionality to pick the searchfield to that module. As for the
breadcrumbs, we'd have to look into that as well, as DataObjects shouldn't
to my opinion be required to have a Title by default. If they are, that's
something to fix in the framework instead of building on onto a wrong
assumption.
from silverstripe-blocks.
Thanks for you input on this guys. I was really on the fence with the idea of adding the Name field or not, there's good arguments on both sides.
With my use of Blocks I've always just had Title for use in both front and backend and that has been fine. And now upgrading my projects to use Blocks 1.0 I am ending up just using the Name field as the Title field in the frontend and backend (I have no need for a second field here).
There is a getTitle method on DataObject that falls back to Name but it's obviously not getting used in all cases.
I'm going to agree with Aram here, we're creating more issues than it's worth and I'm happy to revert back to using Title. If anyone needs a separate field for frontend they can add a Heading field.
Will push the changes up shortly
from silverstripe-blocks.
Reverted in 684d675 Released in 1.0.1
from silverstripe-blocks.
Great thanks guys, I agree arguments on both sides but until the other bits become more flexible it seems like the best bet.
from silverstripe-blocks.
Related Issues (20)
- No blocks tab in page view on SS 3.5.3 HOT 4
- Misleading draft button state
- SilverStripe 4 alpha7 versioning - incorrect namespace
- CMSFields error adding blocks to DataObjects HOT 1
- Blocks don't show in edit page view HOT 6
- Update composer requirements for Symbiote vendor
- Symbiote - namespacing vendor updates in use statements
- Class 'SilverStripe\Core\Object' not found in BlockManager
- BlocksSiteTreeExtension - references BlockSet `PageTypesValue`
- SS4 - used Versioned buttons in CMS
- release tag, please HOT 1
- BUG incorrect symbiote package names in 1.1 branch HOT 1
- Default block area HOT 1
- After duplicating block, content is linked in original & duplicated block.
- Dependent issue Symbiotic 4.x-dev HOT 3
- Using silverstripe-blocks with blog module
- compatible issue with silverstripe-gridfieldextensions 3.1.1
- Silverstripe 4.1 and the future? HOT 3
- SS 3.7.2 / PHP 7.2 Compatibility HOT 1
- multivaluefield 3 is SS4 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from silverstripe-blocks.