btmash
Blob of contradictions
Ashok Modi - LADrupal - April 2016
Please ask questions
Can go whichever direction the group prefers
Demo
$fields['url'] = BaseFieldDefinition::create('string')
->setLabel(t('Font URL'))
->setDescription(t('A URL for the font.'))
->setSettings([
'max_length' => 191,
'text_processing' => 0,
])
->setDefaultValue('')
->setDisplayOptions('view', [
'label' => 'above',
'type' => 'string',
'weight' => -4,
])
->setDisplayOptions('form', [
'type' => 'string_textfield',
'weight' => -4,
])
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
drush updb --entity-updates
drupal update:entities
fontyourface.routing.yml
entity.font.enable:
path: '/admin/appearance/font/{font}/{js}/enable'
defaults:
_title: 'Enable font'
_controller: '\Drupal\fontyourface\Controller\FontYourFaceController::enableFont'
requirements:
_permission: 'administer font entities'
js: 'nojs|ajax'
/**
* Controller routines for forum routes.
*/
class FontYourFaceController extends ControllerBase {
/**
* {@inheritdoc}
*/
public function enableFont($js, Font $font) {
fontyourface.links.action.yml
entity.font_display.add_form:
route_name: 'entity.font_display.add_form'
title: 'Add Font display'
appears_on:
- entity.font_display.collection
fontyourface.links.task.yml
entity.font.collection:
route_name: entity.font.collection
base_route: system.themes_page
title: '@font-your-face'
entity.font.browse:
route_name: entity.font.collection
parent_id: entity.font.collection
title: 'Browse'
fontyourface.links.menu.yml
entity.font.collection:
title: '@font-your-face'
route_name: entity.font.collection
description: 'List Font entities'
parent: system.themes_page
weight: 100
entity.font.browse:
title: 'Browse'
route_name: entity.font.collection
description: 'List Font entities'
parent: entity.font.collection
By btmash
Font Your Face