Conan

Morning Just started looking into GatsbyJS and then found this https://www.gatsbyjs.org/packages/gatsby-source-silverstripe/ hype!! 😄 It's published under the SilverStripe github, so probably something that will be maintained and further developed?

Conan

Ah alright that explains it, thanks for looking it up 🙈 I will try to search the docs more in the future.

Conan

> are you trying to get all 3? just do $articles->exclude(['ID' => 20]) yes I'm trying to get all 3, ah ye exclude ofc 🙈 thanks 👏 Why does the :not return 0 though?

Conan
  1. ‌‌$articles->column()
  2. array (
  3. 0 => 24,
  4. 1 => 23,
  5. 2 => 8,
  6. )
  7.  
  8. ‌‌$articles->filter('ID:not', 20)->count()
  9. 0

Am I using the :not incorrectly?

Conan

oh yea always forget the $owns 🙈 yep that's the issue... thanks @dorsetdigital 👏

👍 (1)
Conan

yes

  1. Document.php
  2. private static $has_one = [
  3. 'File' => File::class,
  4. ];
Conan

My brain aint working right now

  1. <% loop $Documents %>
  2. <!-- Document has_one File -->
  3. $FileID <!-- works -->
  4. $File.ID <!-- nope -->
  5. <a href="$File.Link"><p>$Title</p></a>
  6. <% end_loop %>

Why can't I access the File object? I've fallen into this trap so many times before.. 🙈

Conan

Is it possible to add a new CMS field as the first field in a tab without knowing the insertBefore field?

  1. class BaseElementExtension extends DataExtension
  2. {
  3. const BASE_ELEMENT_TITLE_FIELD_KEY = 'Title';
  4.  
  5. /**
  6.   * @param FieldList $fields
  7.   * @return FieldList
  8.   */
  9. public function updateCMSFields(FieldList $fields)
  10. {
  11. // Remove the default Title field (it is a combined field with Title & ShowTitle)
  12. $fields->removeByName(self::BASE_ELEMENT_TITLE_FIELD_KEY);
  13. $titleField = TextField::create(self::BASE_ELEMENT_TITLE_FIELD_KEY, 'Internal title');
  14. $fields->addFieldToTab('Root.Main', $titleField); // <- I want this field first in the tab!
  15.  
  16. return $fields;
  17. }
  18. }
Conan

@dorsetdigital Alright, good to know -> then I will update my project's readme 😄 Thanks 👍!