This repository has been archived by the owner on Nov 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed the modules submodule and added them correctly
- Loading branch information
1 parent
85321f2
commit 362db0d
Showing
108 changed files
with
7,277 additions
and
1 deletion.
There are no files selected for viewing
Submodule modules
deleted from
6c27b0
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,7 @@ | ||
name: Admin UI Toggle | ||
type: module | ||
description: 'Provides the Admin UI Toggle block' | ||
package: Sector | ||
core: 8.x | ||
dependencies: | ||
- block |
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,11 @@ | ||
admin-ui-toggle: | ||
version: VERSION | ||
css: | ||
component: | ||
css/admin-ui-toggle.css: {} | ||
js: | ||
js/admin_ui_toggle.js: {} | ||
dependencies: | ||
- core/jquery | ||
- core/jquery.once | ||
- core/drupal |
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,11 @@ | ||
<?php | ||
|
||
/** | ||
* Implements hook_theme(). | ||
*/ | ||
function admin_ui_toggle_theme($existing, $type, $theme, $path) { | ||
return [ | ||
'admin_ui_toggle' => [ | ||
], | ||
]; | ||
} |
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,40 @@ | ||
body.admin-ui-hide {padding-top:0px!important;} | ||
.admin-ui-hide #toolbar-bar {display:none!important;} | ||
.admin-ui-hide .contextual-links-wrapper {display:none!important;} | ||
.admin-ui-hide .tabs--primary {display:none!important;} | ||
.admin-ui-hide .alert {display:none!important;} | ||
html body.admin-ui-hide.toolbar-bar {margin-top: 0!important;} | ||
.admin-ui-toggle p { | ||
margin:0;padding:0; | ||
} | ||
.block-admin-ui-toggle { | ||
display: flex; | ||
} | ||
.admin-ui-toggle button { | ||
position: fixed; | ||
top:0; | ||
right:150px; | ||
border: none; | ||
outline:none; | ||
z-index: 9999; | ||
} | ||
.admin-ui-toggle button:before { | ||
content: 'Hide menu'; | ||
font-size: 12px; | ||
line-height: 1; | ||
} | ||
.admin-ui-toggle.ui-is-hidden button:before { | ||
content: 'Show menu'; | ||
} | ||
.admin-ui-toggle button .fa-toggle-off { | ||
display: none; | ||
} | ||
.admin-ui-toggle button .fa-toggle-on { | ||
display: block; | ||
} | ||
.admin-ui-hide .admin-ui-toggle button .fa-toggle-off { | ||
display: block; | ||
} | ||
.admin-ui-hide .admin-ui-toggle button .fa-toggle-on { | ||
display: none; | ||
} |
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,18 @@ | ||
(function ($, Drupal) { | ||
|
||
'use strict'; | ||
|
||
Drupal.behaviors.admin_ui_toggle = { | ||
attach: function (context, settings) { | ||
$("button",".admin-ui-toggle").on('click', function(evt){ | ||
$("body").toggleClass("admin-ui-hide"); | ||
if ($("body").hasClass('admin-ui-hide')) { | ||
$('.admin-ui-toggle').addClass('ui-is-hidden'); | ||
} else { | ||
$('.admin-ui-toggle').removeClass('ui-is-hidden'); | ||
} | ||
evt.preventDefault(); | ||
}); | ||
} | ||
}; | ||
})(jQuery, Drupal); |
32 changes: 32 additions & 0 deletions
32
modules/admin_ui_toggle/src/Plugin/Block/AdminUiToggle.php
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,32 @@ | ||
<?php | ||
|
||
namespace Drupal\admin_ui_toggle\Plugin\Block; | ||
|
||
use Drupal\Core\Block\BlockBase; | ||
|
||
/** | ||
* Provides the admin ui toggle block. | ||
* | ||
* @Block( | ||
* id = "admin_ui_toggle", | ||
* admin_label = @Translation("Sector blocks - Admin UI toggle"), | ||
* ) | ||
*/ | ||
class AdminUiToggle extends BlockBase { | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function build() { | ||
$items = array(); | ||
|
||
return array( | ||
'#theme' => 'admin_ui_toggle', | ||
'#attached' => [ | ||
'library' => [ | ||
'admin_ui_toggle/admin-ui-toggle' | ||
], | ||
], | ||
); | ||
} | ||
} |
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,7 @@ | ||
{% block content %} | ||
<div class="admin-ui-toggle"> | ||
<p> | ||
<button></button> | ||
</p> | ||
</div> | ||
{% endblock %} |
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,13 @@ | ||
{ | ||
"name": "sparksi/sector_modules", | ||
"description": "Project-specific modules for the Sector D8 project", | ||
"type": "drupal-custom-module", | ||
"license": "GPL-2.0+", | ||
"minimum-stability": "dev", | ||
"authors": [ | ||
{ | ||
"name": "Sparks Interactive", | ||
"role": "Development" | ||
} | ||
] | ||
} |
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 @@ | ||
Plain text module | ||
|
||
Probably needs a better name.. | ||
|
||
This module creates a checkbox at at /admin/config/content/formats/manage/{format}. | ||
If this checkbox is ticked then all text pasted in the ckeditor using this text | ||
format will have all formatting stripped. | ||
|
||
This retains the integrity of the Paste from word toolbar button. |
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,52 @@ | ||
/** | ||
* @file | ||
* | ||
* JS file for making sure that intercepts paste events from Ctrl/CMd+V and | ||
* right click and strips the formatting from them using proper Jquery | ||
* functions. | ||
* | ||
* @ignore | ||
*/ | ||
|
||
(function ($, Drupal, drupalSettings, _) { | ||
|
||
'use strict'; | ||
|
||
Drupal.ckeditor = Drupal.ckeditor || {}; | ||
|
||
Drupal.behaviors.plaintext = { | ||
attach: function () { | ||
// Checks if the CKEDITOR currently exists | ||
if (typeof CKEDITOR !== 'undefined') { | ||
CKEDITOR.on('instanceReady', function (i) { | ||
// Gets the editor instance. | ||
var editor = i.editor; | ||
// The paste from word dialog shows up by default on any paste event. | ||
// We don't want that, so this disables it. | ||
editor.config.pasteFromWordPromptCleanup = false; | ||
// Paste event. | ||
editor.on('paste', function (e) { | ||
// Checks if the PlainText config is true, if its false, don't apply | ||
// the processing to the text. | ||
if(editor.config.PlainText === true) { | ||
console.log(e); | ||
console.log(editor); | ||
// Paste events that aren't the pastefromword paste dialog creates | ||
// this $ object inside the editor. We check if it exists. | ||
// | ||
// If it exists it means the paste should be stripped. | ||
if (e.data.dataTransfer.$) { | ||
// Not 100% sure if this is needed. Will test. | ||
e.data.type = 'text'; | ||
|
||
var text = ''; | ||
// Strip the tags using the jQuery.text function. | ||
e.data.dataValue = jQuery(e.data.dataValue).text(); | ||
} | ||
} | ||
}); | ||
}); | ||
} | ||
} | ||
} | ||
})(jQuery, Drupal, drupalSettings, _); |
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,5 @@ | ||
name: Plain Text | ||
type: module | ||
description: 'Plain text plugin for ckeditor' | ||
package: Sector | ||
core: 8.x |
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,7 @@ | ||
plain-text: | ||
version: VERSION | ||
js: | ||
js/plain_text.js: {} | ||
dependencies: | ||
- core/jquery | ||
- core/drupal |
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,26 @@ | ||
<?php | ||
|
||
/** | ||
* Implements hook_page_attachments(). | ||
*/ | ||
function plain_text_page_attachments(array &$attachments) { | ||
// Attach the library. | ||
$attachments['#attached']['library'][] = 'plain_text/plain-text'; | ||
} | ||
|
||
//TODO: MAKE THIS AND THE JS NICER | ||
|
||
function plain_text_editor_js_settings_alter(array &$settings) { | ||
// Get all active formats. | ||
$filters_list = filter_formats(); | ||
|
||
// For every text format, check if the Enable plain text filter is enabled, | ||
// if it is, set the variable so it can be used later in the JS. | ||
foreach (array_keys($settings['editor']['formats']) as $text_format_id) { | ||
$format_filter = $filters_list[$text_format_id]->filters()->getAll(); | ||
$format_filter_config = $format_filter['plain_text_filter']->getConfiguration(); | ||
if($format_filter_config['status']) { | ||
$settings['editor']['formats'][$text_format_id]['editorSettings']['PlainText'] = TRUE; | ||
} | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Drupal\plain_text\Plugin\Filter; | ||
|
||
use Drupal\filter\Plugin\FilterBase; | ||
use Drupal\filter\FilterProcessResult; | ||
|
||
/** | ||
* @Filter( | ||
* id = "plain_text_filter", | ||
* title = @Translation("Enforce plain text paste"), | ||
* description = @Translation("If enabled, all text pasted directly into the CKEditor will be stripped of all tags and pasted as plain text."), | ||
* type = Drupal\filter\Plugin\FilterInterface::TYPE_HTML_RESTRICTOR, | ||
* ) | ||
*/ | ||
class PlainTextFilter extends FilterBase { | ||
|
||
public function process($text, $langcode) { | ||
// The text is processed using the JS that is loaded if this filter is | ||
// enabled. Thus we only need to return the same text sent to this function. | ||
$result = new FilterProcessResult($text); | ||
return $result; | ||
} | ||
} |
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,6 @@ | ||
name: Sector blocks | ||
description: Provides custom blocks for Sector | ||
package: Sector | ||
|
||
type: module | ||
core: 8.x |
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,17 @@ | ||
<?php | ||
|
||
/** | ||
* Implements hook_theme(). | ||
*/ | ||
function sector_blocks_theme($existing, $type, $theme, $path) { | ||
return [ | ||
'responsive_menu_control_block' => [ | ||
], | ||
'search_desktop_fly_out_control_block' => [ | ||
], | ||
'search_api_box' => [ | ||
], | ||
'search_api_box_mobile' => [ | ||
], | ||
]; | ||
} |
25 changes: 25 additions & 0 deletions
25
modules/sector_blocks/src/Plugin/Block/ResponsiveMenuControls.php
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,25 @@ | ||
<?php | ||
|
||
namespace Drupal\sector_blocks\Plugin\Block; | ||
|
||
use Drupal\Core\Block\BlockBase; | ||
|
||
/** | ||
* Provides the responsive menu controls block. | ||
* | ||
* @Block( | ||
* id = "responsive_menu_controls", | ||
* admin_label = @Translation("Sector blocks - Responsive menu controls"), | ||
* ) | ||
*/ | ||
class ResponsiveMenuControls extends BlockBase { | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function build() { | ||
$build = []; | ||
$build['#theme'] = 'responsive_menu_control_block'; | ||
|
||
return $build; | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
|
||
namespace Drupal\sector_blocks\Plugin\Block; | ||
|
||
use Drupal\Core\Block\BlockBase; | ||
|
||
/** | ||
* Provides the search api box block. Replicates the default search block design. | ||
* | ||
* @Block( | ||
* id = "search_api_box", | ||
* admin_label = @Translation("Sector blocks - Search API block"), | ||
* ) | ||
*/ | ||
class SearchApiBox extends BlockBase { | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function build() { | ||
$build = []; | ||
$build['#theme'] = 'search_api_box'; | ||
|
||
return $build; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
modules/sector_blocks/src/Plugin/Block/SearchApiBoxMobile.php
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,26 @@ | ||
<?php | ||
|
||
namespace Drupal\sector_blocks\Plugin\Block; | ||
|
||
use Drupal\Core\Block\BlockBase; | ||
|
||
/** | ||
* Provides the search api box block. Replicates the default search block design. | ||
* Mobile version. | ||
* | ||
* @Block( | ||
* id = "search_api_box_mobile", | ||
* admin_label = @Translation("Sector blocks - Search API block (mobile)"), | ||
* ) | ||
*/ | ||
class SearchApiBoxMobile extends BlockBase { | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function build() { | ||
$build = []; | ||
$build['#theme'] = 'search_api_box_mobile'; | ||
|
||
return $build; | ||
} | ||
} |
Oops, something went wrong.