Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WCMS
uw_cfg_common
Commits
9481e009
Commit
9481e009
authored
Dec 02, 2021
by
Chris Shantz
Browse files
Merge branch '1.0.x' into prod/1.0.x
parents
20e919ee
a42b6979
Changes
20
Expand all
Hide whitespace changes
Inline
Side-by-side
config/install/layout_builder_browser.layout_builder_browser_block.uw_lbb_service_teaser.yml
0 → 100644
View file @
9481e009
langcode
:
en
status
:
true
dependencies
:
{
}
id
:
uw_lbb_service_teaser
block_id
:
uw_cbl_service_teaser
category
:
uw_bc_teasers
label
:
'
Service
teaser'
weight
:
-100
image_path
:
images/layout_builder_browser/serviceteaser.svg
image_path_base
:
'
theme:uw_fdsu_theme_resp'
image_alt
:
'
Service
teaser'
config/install/layout_builder_browser.layout_builder_browser_block.uw_lbb_services_list.yml
0 → 100644
View file @
9481e009
langcode
:
en
status
:
true
dependencies
:
{
}
id
:
uw_lbb_services_list
block_id
:
'
inline_block:uw_cbl_services_list'
category
:
uw_bc_listings
label
:
'
Services
list'
weight
:
0
image_path
:
images/layout_builder_browser/servicelist.svg
image_path_base
:
'
theme:uw_fdsu_theme_resp'
image_alt
:
'
Services
listing'
config/install/layout_builder_browser.layout_builder_browser_block.uw_lbb_services_search.yml
0 → 100644
View file @
9481e009
langcode
:
en
status
:
true
dependencies
:
{
}
id
:
uw_lbb_services_search
block_id
:
uw_cbl_services_search
category
:
uw_bc_searches
label
:
'
Services
search'
weight
:
0
image_path
:
images/layout_builder_browser/servicesearch.svg
image_path_base
:
'
theme:uw_fdsu_theme_resp'
image_alt
:
'
Services
search'
config/install/pathauto.pattern.uw_path_opportunities.yml
0 → 100644
View file @
9481e009
langcode
:
en
status
:
true
dependencies
:
module
:
-
node
id
:
uw_path_opportunities
label
:
'
Opportunities
path
pattern'
type
:
'
canonical_entities:node'
pattern
:
'
opportunities/[node:title]'
selection_criteria
:
85a0576d-37f6-4897-92c2-cc7f18605172
:
id
:
node_type
bundles
:
uw_ct_opportunity
:
uw_ct_opportunity
negate
:
false
context_mapping
:
node
:
node
uuid
:
85a0576d-37f6-4897-92c2-cc7f18605172
selection_logic
:
and
weight
:
-5
relationships
:
{
}
config/install/simple_sitemap.bundle_settings.default.menu_link_content.main.yml
0 → 100644
View file @
9481e009
index
:
true
priority
:
'
0.5'
changefreq
:
daily
include_images
:
false
config/install/simple_sitemap.custom_links.default.yml
0 → 100644
View file @
9481e009
links
:
-
path
:
/
priority
:
'
1.0'
changefreq
:
daily
config/install/simple_sitemap.settings.yml
0 → 100644
View file @
9481e009
max_links
:
2000
cron_generate
:
true
cron_generate_interval
:
24
generate_duration
:
10000
entities_per_queue_item
:
50
remove_duplicates
:
true
skip_untranslated
:
true
xsl
:
false
base_url
:
'
'
default_variant
:
default
custom_links_include_images
:
false
excluded_languages
:
{
}
enabled_entity_types
:
-
node
-
menu_link_content
disable_language_hreflang
:
false
src/Access/UwNodeAccessCheck.php
View file @
9481e009
...
...
@@ -8,7 +8,6 @@ use Drupal\Core\Routing\RouteMatchInterface;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\menu_admin_per_menu
\
Access\MenuAdminPerMenuAccess
;
use
Drupal\uw_cfg_common
\
Service\UWService
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
/**
* Checks access for displaying configuration translation page.
...
...
@@ -65,19 +64,17 @@ class UwNodeAccessCheck implements AccessInterface {
$node
=
$route_match
->
getParameter
(
'node'
);
// Check if this is a sidebar content type and if the user has permission
// to edit the content type. We want to throw a 404 (NotFoundHttpException)
// if they do not have access. This is the case when a user is not logged
// in, and when they do not have permission to edit it.
// to edit the content type. Return access denied when user has no edit
// permission.
if
(
$node
&&
$node
->
bundle
()
==
'uw_ct_sidebar'
&&
!
$account
->
hasPermission
(
'edit any uw_ct_sidebar content'
))
{
throw
new
NotFoundHttpExceptio
n
();
return
AccessResult
::
forbidde
n
();
}
// Check if this is a sidebar content type and if the user has permission
// to edit the content type. We want to throw a 404 (NotFoundHttpException)
// if they do not have access. This is the case when a user is not logged
// in, and when they do not have permission to edit it.
// to edit the content type. Return access denied when user has no edit
// permission.
if
(
$node
&&
$node
->
bundle
()
==
'uw_ct_site_footer'
&&
!
$account
->
hasPermission
(
'edit any uw_ct_site_footer content'
))
{
throw
new
NotFoundHttpExceptio
n
();
return
AccessResult
::
forbidde
n
();
}
// We have to return some type of access, so we are going to return
...
...
src/Plugin/CKEditorPlugin/MathJaxPlugin.php
View file @
9481e009
...
...
@@ -57,7 +57,6 @@ class MathJaxPlugin extends CKEditorPluginBase implements ContainerFactoryPlugin
'clipboard'
,
'dialog'
,
'lineutils'
,
'widget'
,
];
}
...
...
src/Service/UWService.php
View file @
9481e009
This diff is collapsed.
Click to expand it.
src/Service/UWServiceInterface.php
View file @
9481e009
...
...
@@ -3,7 +3,6 @@
namespace
Drupal\uw_cfg_common\Service
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Field\EntityReferenceFieldItemListInterface
;
use
Drupal\node\Entity\Node
;
/**
...
...
@@ -16,47 +15,38 @@ use Drupal\node\Entity\Node;
interface
UWServiceInterface
{
/**
*
Prepares responsive image
.
*
Get the image styles used in UW crops
.
*
* @param
\Drupal\Core\Entity\EntityInterface $entity
*
Image entity
.
* @param
string $image_style
*
Image style to be used for responsive image
.
* @param
string $type
*
The type of styles to get
.
* @param
bool $get_all
*
Flag to get all the image styles
.
*
* @return
array
* Array
with details for responsive image
.
* @return
string[]
* Array
of image styles that are used
.
*/
public
function
prepareResponsiveImage
(
EntityInterface
$entity
,
string
$image_style
):
array
;
public
function
getCropImageStyles
(
string
$type
,
bool
$get_all
=
FALSE
):
array
;
/**
* Prepares
teaser
.
* Prepares
responsive image
.
*
* @param \Drupal\node\Node $node
* Node entity.
* @param string $view_mode
* The view mode (i.e. node, teaser, etc).
* @param string $content
* The type of content to get, values are all, header or footer.
* @param \Drupal\Core\Entity\EntityInterface|null $entity
* Image entity or null.
* @param string $image_style
* Image style to be used for responsive image.
*
* @return array
* Array
of variables and their values
.
* Array
with details for responsive image
.
*/
public
function
uwGetNodeContent
(
Node
$node
,
string
$view_mode
,
string
$content
=
'all'
):
array
;
public
function
prepareResponsiveImage
(
EntityInterface
$entity
,
string
$image_style
):
array
;
/**
* Gets teaser data.
*
* @param \Drupal\node\Node $node
* Node entity.
* @param string $view_mode
* The view mode (i.e. node, teaser, etc).
* @param array $content_data
* An array of all the data to get for the teaser.
* Get the UW images styles used in UW responsive image.
*
* @return array
* Array of
node valu
es.
* Array of
image styl
es.
*/
public
function
uwGet
NodeData
(
Node
$node
,
string
$view_mode
,
array
$content_data
):
array
;
public
function
uwGet
ResponsiveImageStyles
(
):
array
;
/**
* Gets content types that have feature images.
...
...
@@ -80,73 +70,6 @@ interface UWServiceInterface {
*/
public
function
uwCheckNodeForFeaturedImage
(
Node
$node
):
string
;
/**
* Gets dates from node.
*
* @param \Drupal\node\Node $node
* Node entity.
* @param string $field_name
* The field name that has the date(s).
* @param string $view_mode
* The view mode of the node.
*
* @return array
* Array of dates.
*/
public
function
uwGetDates
(
Node
$node
,
string
$field_name
,
string
$view_mode
):
array
;
/**
* Get a date in the proper format.
*
* @param array $date
* An array of date info.
* @param string $type
* The type of date.
*
* @return string
* A converted date to a string.
*/
public
function
uwGetDate
(
array
$date
,
string
$type
):
string
;
/**
* Gets image from node.
*
* @param \Drupal\node\Node $node
* Node entity.
* @param string $field_name
* The field name that has the date(s).
*
* @return array
* array with image information.
*/
public
function
uwGetImage
(
Node
$node
,
string
$field_name
):
array
;
/**
* Gets sources from node.
*
* @param \Drupal\node\Node $node
* Node entity.
* @param string $field_name
* The field name that has the date(s).
*
* @return array
* Either array with responsive image.
*/
public
function
uwGetSources
(
Node
$node
,
string
$field_name
):
array
;
/**
* Gets link info from node.
*
* @param \Drupal\node\Node $node
* Node entity.
* @param string $field_name
* The field name that has the date(s).
*
* @return array
* Array with link info.
*/
public
function
uwGetLinkInfo
(
Node
$node
,
string
$field_name
):
array
;
/**
* A function to get or check the attached sidebar.
*
...
...
@@ -272,43 +195,4 @@ interface UWServiceInterface {
*/
public
function
uwMonthNameShort
(
int
$month
=
NULL
);
/**
* A function get the taxonomy terms.
*
* @param array $tids
* An array of term ids (tids).
* @param string $type
* The type of terms to get, if none provided just term name returned.
*
* @return array
* An array of terms with name and link.
*/
public
function
uwGetTerms
(
array
$tids
,
string
$type
=
NULL
):
array
;
/**
* A function to get the footer data for a node/content type.
*
* @param \Drupal\node\Entity\Node $node
* The node object.
*
* @return array
* An array of author name and link.
*/
public
function
uwGetAuthor
(
Node
$node
):
array
;
/**
* Function that parses terms and returns a list.
*
* @param \Drupal\Core\Field\EntityReferenceFieldItemListInterface $values
* List of values for the provided field.
* @param string|null $type
* The type of terms to get, if none provided just term name returned.
*
* @return array
* List of terms with name and link.
*
* @throws \Drupal\Core\Entity\EntityMalformedException
*/
public
function
uwGetTermsFromEntityField
(
EntityReferenceFieldItemListInterface
$values
,
string
$type
=
NULL
):
array
;
}
src/Service/UwNodeContent.php
0 → 100644
View file @
9481e009
<?php
namespace
Drupal\uw_cfg_common\Service
;
use
Drupal\node\Entity\Node
;
/**
* Class UwNodeContent.
*
* Gets the content out of a node.
*
* @package Drupal\uw_cfg_common\Service
*/
class
UwNodeContent
{
/**
* The UW node data service.
*
* @var UwNodeData
*/
private
$uwNodeData
;
/**
* Default constructor.
*
* @param UwNodeData $uwNodeData
* The UW node data service.
*/
public
function
__construct
(
UwNodeData
$uwNodeData
)
{
$this
->
uwNodeData
=
$uwNodeData
;
}
/**
* Gets the content of a node.
*
* @param \Drupal\node\Entity\Node $node
* The node.
* @param string $view_mode
* The view mode.
* @param string $content
* The content to get (either layout builder or summary).
*
* @return array
* Array of content to get from the node.
*
* @throws \Drupal\Core\Entity\EntityMalformedException
*/
public
function
getNodeContent
(
Node
$node
,
string
$view_mode
,
string
$content
):
array
{
// Get the flags for the node.
$node_flags
=
$this
->
getNodeFlags
(
$node
,
$view_mode
,
$content
);
// Setup the node data array, based on flags.
switch
(
$node
->
getType
())
{
case
'uw_ct_blog'
:
$content_data
=
$this
->
getBlogContent
(
$node_flags
);
break
;
case
'uw_ct_event'
:
$content_data
=
$this
->
getEventContent
(
$node_flags
);
break
;
case
'uw_ct_news_item'
:
$content_data
=
$this
->
getNewsContent
(
$node_flags
);
break
;
case
'uw_ct_web_page'
:
$content_data
=
$this
->
getWebPageContent
(
$node_flags
);
break
;
case
'uw_ct_catalog_item'
:
$content_data
=
$this
->
getCatalogItemContent
(
$node_flags
);
break
;
case
'uw_ct_contact'
:
$content_data
=
$this
->
getContactContent
(
$node_flags
);
break
;
case
'uw_ct_profile'
:
$content_data
=
$this
->
getProfileContent
(
$node_flags
);
break
;
case
'uw_ct_service'
:
$content_data
=
$this
->
getServiceContent
(
$node_flags
);
break
;
}
return
$this
->
uwNodeData
->
getNodeData
(
$node
,
$view_mode
,
$content_data
);
}
/**
* Get the content types that have hero images.
*
* @return string[]
* Array of content types that can have hero images.
*/
public
function
getHeroImageContentTypes
():
array
{
return
[
'uw_ct_blog'
=>
'field_uw_hero_image'
,
'uw_ct_event'
=>
'field_uw_hero_image'
,
'uw_ct_news_item'
=>
'field_uw_hero_image'
,
];
}
/**
* Get the flags for the node.
*
* @param \Drupal\node\Entity\Node $node
* The node.
* @param string $view_mode
* The view mode.
* @param string $content
* The content to get (layout builder or summary).
*
* @return array
* Array of flags for the node.
*/
public
function
getNodeFlags
(
Node
$node
,
string
$view_mode
,
string
$content
):
array
{
// Flags for getting teaser content.
$node_flags
[
'get_header'
]
=
FALSE
;
$node_flags
[
'get_footer'
]
=
FALSE
;
$node_flags
[
'get_image'
]
=
FALSE
;
$node_flags
[
'get_content'
]
=
FALSE
;
$node_flags
[
'get_title'
]
=
FALSE
;
$node_flags
[
'get_hero'
]
=
FALSE
;
$node_flags
[
'get_tags'
]
=
TRUE
;
// Setup flags based on teaser content argument.
if
(
$content
==
'all'
)
{
$node_flags
[
'get_header'
]
=
TRUE
;
$node_flags
[
'get_footer'
]
=
TRUE
;
$node_flags
[
'get_content'
]
=
TRUE
;
if
(
$view_mode
==
'full'
)
{
$node_flags
[
'get_title'
]
=
TRUE
;
$node_flags
[
'get_hero'
]
=
TRUE
;
if
(
$node
->
getType
()
==
'uw_ct_contact'
)
{
$node_flags
[
'get_image'
]
=
TRUE
;
}
}
elseif
(
$view_mode
==
'teaser'
)
{
if
(
$node
->
getType
()
!==
'uw_ct_contact'
)
{
$node_flags
[
'get_footer'
]
=
FALSE
;
}
$node_flags
[
'get_image'
]
=
TRUE
;
$node_flags
[
'get_title'
]
=
TRUE
;
}
}
else
{
if
(
$content
==
'header'
)
{
if
(
$node
->
getType
()
==
'uw_ct_contact'
)
{
$node_flags
[
'get_image'
]
=
TRUE
;
}
$node_flags
[
'get_header'
]
=
TRUE
;
$node_flags
[
'get_title'
]
=
TRUE
;
$node_flags
[
'get_hero'
]
=
TRUE
;
$node_flags
[
'get_tags'
]
=
FALSE
;
}
if
(
$content
==
'footer'
)
{
$node_flags
[
'get_footer'
]
=
TRUE
;
$node_flags
[
'get_title'
]
=
FALSE
;
}
}
return
$node_flags
;
}
/**
* Common elements for content data.
*
* @param array $node_flags
* The flags for the node.
*
* @return array
* Array of common elements for content data.
*/
public
function
setupContentData
(
array
$node_flags
):
array
{
$content_data
[
'url'
]
=
[
'type'
=>
'url'
,
];
$content_data
[
'header'
]
=
[
'has_children'
=>
TRUE
,
];
if
(
$node_flags
[
'get_title'
])
{
$content_data
[
'header'
][
'title'
]
=
[
'type'
=>
'title'
,
];
}
return
$content_data
;
}
/**
* Functiont to add to content data array.
*
* @param string $type
* The type of field.
* @param mixed $field_name
* The actual field name(s).
* @param string|null $label
* The label to be used with the field.
*
* @return string[]
* Array to add to the content data.
*/
public
function
addToContentData
(
string
$type
,
$field_name
,
string
$label
=
NULL
):
array
{
return
[
'type'
=>
$type
,
'field'
=>
$field_name
,
'label'
=>
$label
,
];
}
/**
* Get the node content for blog content type.
*
* @param array $node_flags
* The flags for the node.
*
* @return array
* Array of content to get from the node.
*/
public
function
getBlogContent
(
array
$node_flags
):
array
{
// Get the content data.
$content_data
=
$this
->
setupContentData
(
$node_flags
);
// Setup the header content.
if
(
$node_flags
[
'get_header'
])
{
$content_data
[
'header'
][
'date'
]
=
$this
->
addToContentData
(
'date'
,
'field_uw_blog_date'
);
$content_data
[
'header'
][
'author'
]
=
$this
->
addToContentData
(
'author'
,
'field_author'
);
}
// Get the hero image.
if
(
$node_flags
[
'get_hero'
])
{
$content_data
[
'hero_image'
]
=
$this
->
addToContentData
(
'sources'
,
'field_uw_hero_image'
);
}
// Get the listing image.
if
(
$node_flags
[
'get_image'
])
{
$content_data
[
'image'
]
=
$this
->
addToContentData
(
'image'
,
'field_uw_blog_listing_page_image'
);
$content_data
[
'image'
][
'extra_options'
]
=
[
'type'
=>
'listing_image'
,
'is_responsive'
=>
TRUE
,
];
}
// Setup the actual content.
if
(
$node_flags
[
'get_content'
])
{
$content_data
[
'content'
]
=
$this
->
addToContentData
(
'content'
,
'field_uw_blog_summary'
);
}
// Get the tags, if any.
if
(
$node_flags
[
'get_tags'
])
{
$content_data
[
'tags'
]
=
$this
->
addToContentData
(
'terms'
,
[
'field_uw_blog_tags'
,
'field_uw_audience'
,
]
);
}
return
$content_data
;
}
/**
* Get the node content for event content type.
*
* @param array $node_flags
* The flags for the node.
*
* @return array
* Array of content to get from the node.
*/
public
function
getEventContent
(
array
$node_flags
):
array
{
// Setup the content data array.
$content_data
=
$this
->
setupContentData
(
$node_flags
);
// Setup the header content.
if
(
$node_flags
[
'get_header'
])
{
$content_data
[
'header'
][
'date'
]
=
$this
->
addToContentData
(
'date'
,
'field_uw_event_date'
);
}
// Get hero image.