FAQ
| This is a
LIVE
service |
Changelog
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-cambridge-profile
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Information Services
DevOps
Drupal team
drupal-cambridge-profile
Commits
fea53f25
Commit
fea53f25
authored
10 years ago
by
thewilkybarkid
Browse files
Options
Downloads
Patches
Plain Diff
Use Smart Trim in teasers
parent
c81e93be
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!14
Use Smart Trim in teasers
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cambridge/cambridge.info
+1
-0
1 addition, 0 deletions
src/cambridge/cambridge.info
src/cambridge/cambridge.install
+88
-0
88 additions, 0 deletions
src/cambridge/cambridge.install
src/cambridge/cambridge.make
+3
-0
3 additions, 0 deletions
src/cambridge/cambridge.make
with
92 additions
and
0 deletions
src/cambridge/cambridge.info
+
1
−
0
View file @
fea53f25
...
...
@@ -47,6 +47,7 @@ dependencies[] = pathauto
dependencies[] = raven
dependencies[] = realname
dependencies[] = redirect
dependencies[] = smart_trim
dependencies[] = token
dependencies[] = transliteration
dependencies[] = views
...
...
This diff is collapsed.
Click to expand it.
src/cambridge/cambridge.install
+
88
−
0
View file @
fea53f25
...
...
@@ -57,6 +57,36 @@ function cambridge_install() {
field_create_instance
(
$instance
);
}
// Use the Smart Trim module for teasers.
$smart_trimmed
=
array
(
'label'
=>
'hidden'
,
'module'
=>
'smart_trim'
,
'settings'
=>
array
(
'more_link'
=>
0
,
'more_text'
=>
'Read more'
,
'summary_handler'
=>
'full'
,
'trim_length'
=>
325
,
'trim_options'
=>
array
(
'text'
=>
'text'
,
),
'trim_suffix'
=>
'...'
,
'trim_type'
=>
'chars'
,
),
'type'
=>
'smart_trim_format'
,
'weight'
=>
0
,
);
foreach
(
array
(
'page'
,
'link'
)
as
$type
)
{
$instance
=
field_info_instance
(
'node'
,
'body'
,
$type
);
foreach
(
array
(
'teaser'
,
'news_listing_item'
,
'vertical_teaser'
,
'sidebar_teaser'
)
as
$mode
)
{
$instance
[
'display'
][
$mode
]
=
$smart_trimmed
;
}
field_update_instance
(
$instance
);
}
// Force a main-menu link on Basic Pages.
variable_set
(
'menu_force_page'
,
TRUE
);
...
...
@@ -291,3 +321,61 @@ function cambridge_update_7102() {
throw
new
DrupalUpdateException
(
'Failed to enabled Metatag modules'
);
}
}
/**
* Use the Smart Trim module for teasers rather than Drupal's native trimming.
*/
function
cambridge_update_7103
()
{
if
(
module_exists
(
'smart_trim'
))
{
return
;
}
if
(
FALSE
===
module_enable
(
array
(
'smart_trim'
)))
{
throw
new
DrupalUpdateException
(
'Failed to install Smart Trim module'
);
}
$smart_trimmed
=
array
(
'label'
=>
'hidden'
,
'module'
=>
'smart_trim'
,
'settings'
=>
array
(
'more_link'
=>
0
,
'more_text'
=>
'Read more'
,
'summary_handler'
=>
'full'
,
'trim_length'
=>
325
,
'trim_options'
=>
array
(
'text'
=>
'text'
,
),
'trim_suffix'
=>
'...'
,
'trim_type'
=>
'chars'
,
),
'type'
=>
'smart_trim_format'
,
);
foreach
(
array
(
'page'
,
'link'
)
as
$type
)
{
// Make sure the body appears trimmed in teasers.
if
(
FALSE
===
node_type_get_name
(
$type
))
{
// Content type no longer exists.
continue
;
}
$instance
=
field_info_instance
(
'node'
,
'body'
,
$type
);
foreach
(
array
(
'teaser'
,
'news_listing_item'
,
'vertical_teaser'
,
'sidebar_teaser'
)
as
$mode
)
{
if
(
$instance
[
'display'
][
$mode
][
'label'
]
!==
'hidden'
||
$instance
[
'display'
][
$mode
][
'type'
]
!==
'text_summary_or_trimmed'
||
$instance
[
'display'
][
$mode
][
'settings'
][
'trim_length'
]
!==
600
)
{
// Display has been changed, so don't touch it.
continue
;
}
$instance
[
'display'
][
$mode
]
=
array_merge
(
$instance
[
'display'
][
$mode
],
$smart_trimmed
);
}
field_update_instance
(
$instance
);
}
}
This diff is collapsed.
Click to expand it.
src/cambridge/cambridge.make
+
3
−
0
View file @
fea53f25
...
...
@@ -55,6 +55,9 @@ projects[redirect][subdir] = "patched"
projects[redirect][patch][] = "http
:
//drupal.org/files/redirect-prevent_circular_redirects-1817976-42.patch"
projects[rules]
=
"2.6"
projects[scheduler]
=
"1.2"
projects[smart_trim][version]
=
"1.4"
projects[smart_trim][subdir]
=
"patched"
projects[smart_trim][patch][] = "http
:
//drupal.org/files/issues/smart_trim_remove_punctuation_from_end_of_truncated_output-2169583-3.patch"
projects[tac_lite]
=
"1.2"
projects[transliteration]
=
"3.2"
projects[varnish][version]
=
"1.0-beta2"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment