-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
182 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const versionStates = { | ||
draft: 'draft', | ||
modified: 'modified', | ||
unversioned: 'unversioned', | ||
unsaved: 'unsaved', | ||
published: 'published', | ||
}; | ||
|
||
export default versionStates; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace SilverStripe\LinkField\Extensions; | ||
|
||
use SilverStripe\Core\Extension; | ||
use SilverStripe\Forms\GridField\GridField; | ||
use SilverStripe\Forms\FieldList; | ||
use TractorCow\Fluent\Extension\FluentVersionedExtension; | ||
|
||
class FluentLinkExtension extends Extension | ||
{ | ||
public function updateCMSFields(FieldList $fields) | ||
{ | ||
$this->removeTabsWithFluentGridfields($fields); | ||
} | ||
|
||
/** | ||
* Remove tabs added by fluent that contain GridFields | ||
* This is done for because there is currently no react component for a GridFields | ||
* When using tractorcow/silverstripe-fluent tabs will be automatically added | ||
* that contain a GridFields which will cause LinkField modal to trigger a server error | ||
*/ | ||
private function removeTabsWithFluentGridfields(FieldList $fields): void | ||
{ | ||
// Only remove tabs if there is no GridField react component specified | ||
$schemaDataType = GridField::create('tmp')->getSchemaDataType(); | ||
if ($schemaDataType !== null) { | ||
return; | ||
} | ||
// Remove the tabs that contains the gridfields | ||
if ($this->getOwner()->hasExtension(FluentVersionedExtension::class)) { | ||
$fields->removeByName(['Locales', 'FilteredLocales']); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,15 @@ | ||
<%-- This template is here to bootstrap a LinkField React form field --%> | ||
<%-- It includes some pre-rendered content to provide a nicer UI while waiting for React to boot --%> | ||
<%-- Once React is done pre-rendering, it will discard the pre-rendered markup --%> | ||
<input $AttributesHTML /> | ||
<div data-field-id="$ID" data-schema-component="$SchemaComponent" class="entwine-linkfield" data-types="$TypesProp"></div> | ||
<div data-field-id="$ID" data-schema-component="$SchemaComponent" class="entwine-linkfield" data-types="$TypesProp"> | ||
<div class="link-field__container"> | ||
<% include SilverStripe/LinkField/Form/LinkField_Spinner %> | ||
<div> | ||
<div class="link-picker__link link-picker__link--is-first link-picker__link--is-last form-control link-picker__link--disabled link-picker__link--published" role="button" aria-disabled="false" aria-roledescription="sortable" aria-describedby="" id="link-picker__link-42"> | ||
<button type="button" disabled="" class="link-picker__button font-icon-link btn btn-secondary disabled"></button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<%-- This template is here to bootstrap a LinkField React form field --%> | ||
<%-- It includes a pre-rendered spinner to provide a nicer UI while waiting for React to boot --%> | ||
<%-- Once React is done pre-rendering, it will discard the pre-rendered markup --%> | ||
<div class="link-field__loading"> | ||
<div class="cms-content-loading-overlay ui-widget-overlay-light"></div> | ||
<% include SilverStripe/Admin/Includes/CMSLoadingSpinner %> | ||
</div> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,35 @@ | ||
<%-- This template is here to bootstrap a MultiLinkField React form field --%> | ||
<%-- It includes some pre-rendered content to provide a nicer UI while waiting for React to boot --%> | ||
<%-- Once React is done pre-rendering, it will discard the pre-rendered markup --%> | ||
<input $AttributesHTML /> | ||
<div data-is-multi="true" data-field-id="$ID" data-schema-component="$SchemaComponent" class="entwine-linkfield" data-types="$TypesProp"></div> | ||
<div data-is-multi="true" data-field-id="$ID" data-schema-component="$SchemaComponent" class="entwine-linkfield" data-types="$TypesProp"> | ||
|
||
<div class="link-field__container"> | ||
<% include SilverStripe/LinkField/Form/LinkField_Spinner %> | ||
<div class="link-picker form-control"> | ||
<div class="link-picker__menu dropdown"> | ||
<button | ||
type="button" | ||
aria-haspopup="true" | ||
aria-expanded="false" | ||
class="link-picker__menu-toggle font-icon-plus-1 dropdown-toggle btn btn-secondary" | ||
aria-label="<%t SilverStripe\LinkField\Models\MultiLinkField.AddLink "Add link" %>"> | ||
<%t SilverStripe\LinkField\Models\MultiLinkField.AddLink "Add link" %> | ||
</button> | ||
</div> | ||
</div> | ||
<div class="link-picker-links"> | ||
<% loop $LinkIDs %> | ||
<div class="link-picker__link form-control link-picker__link--published <% if $IsFirst %>link-picker__link--is-first<% end_if %> <% if $IsLast %>link-picker__link--is-last<% end_if %>"> | ||
<button | ||
type="button" | ||
disabled="" | ||
class="link-picker__button font-icon-link btn btn-secondary disabled" | ||
aria-label="<%t SilverStripe\LinkField\Models\MultiLinkField.EditLink "Edit link" %>"></button> | ||
</div> | ||
<% end_loop %> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.