Syntaxhighlight: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
(Die Seite wurde neu angelegt: „<syntaxhighlight lang="python" line> def quick_sort(arr): less = [] pivot_list = [] more = [] if len(arr) <= 1: return arr else: pass </syntaxhighlight>“) |
Keine Bearbeitungszusammenfassung |
||
| (7 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 1: | Zeile 1: | ||
<syntaxhighlight lang=" | == json == | ||
<syntaxhighlight lang="json" line> | |||
{ | |||
"state": "xtwf_improvement", | |||
"league": 0, | |||
"workflow": "mytrunkb01", | |||
"severity": "light", | |||
"data": { | |||
"finalize_by_timeout": false, | |||
"finalize_strict": false, | |||
"started": 1663003556, | |||
"changed": 1663402590, | |||
"user_data": [], | |||
"state_data": { | |||
"menu-tid": "408", | |||
"slogitem-id": "695", | |||
"status": "1", | |||
"max_comments": 30, | |||
"has_max_comments": false | |||
}, | |||
"jsmeta_data": { | |||
"contribution": { | |||
"type": "loadContent", | |||
"slogitem_id": 695, | |||
"isDiscussion": true | |||
} | |||
}, | |||
"improve_data": { | |||
"cc_base_tid": "405", | |||
"cc_history_timestamp": 1663003486, | |||
"min_final_value": 62.99, | |||
"improver_sids": "211;686;689;684;688;687", | |||
"delay_done": 4 | |||
} | |||
}, | |||
"expire": 1663947909 | |||
} | |||
</syntaxhighlight> | |||
== php == | |||
<syntaxhighlight lang="php" highlight="3-5,8,15-17,30" line> | |||
<?php | |||
/** | |||
* @file | |||
* Contains \Drupal\sxt_mediawiki\Plugin\Field\FieldType\MwCommentFieldType. | |||
*/ | |||
namespace Drupal\sxt_mediawiki\Plugin\Field\FieldType; | |||
use Drupal\sxt_mediawiki\Plugin\Field\FieldType\MediaWikiFieldType; | |||
use Drupal\Core\Field\FieldDefinitionInterface; | |||
/** | |||
* Plugin implementation of the 'sxt_mwcomment' field type. | |||
* | |||
* @FieldType( | |||
* id = "sxt_mwcomment", | |||
* label = @Translation("MW Comment"), | |||
* description = @Translation("This field stores comments in mediawiki format."), | |||
* category = @Translation("Text"), | |||
* default_widget = "sxt_mediawiki", | |||
* default_formatter = "sxt_mediawiki" | |||
* ) | |||
*/ | |||
class MwCommentFieldType extends MediaWikiFieldType { | |||
/** | |||
* {@inheritdoc} | |||
*/ | |||
public static function generateSampleValue(FieldDefinitionInterface $field_definition) { | |||
$values['value'] = self::generateParagraphs(mt_rand(1, 4), self::PARA_TEXT); | |||
return $values; | |||
} | |||
protected static function getParagraphsAvailable() { | |||
return [ | |||
self::PARA_TEXT, | |||
self::PARA_ULIST, | |||
self::PARA_ULIST, | |||
self::PARA_OLIST, | |||
self::PARA_OLIST, | |||
self::PARA_DEFLIST, | |||
]; | |||
} | |||
} | |||
</syntaxhighlight> | |||
Aktuelle Version vom 6. August 2024, 12:46 Uhr
json[Bearbeiten]
{
"state": "xtwf_improvement",
"league": 0,
"workflow": "mytrunkb01",
"severity": "light",
"data": {
"finalize_by_timeout": false,
"finalize_strict": false,
"started": 1663003556,
"changed": 1663402590,
"user_data": [],
"state_data": {
"menu-tid": "408",
"slogitem-id": "695",
"status": "1",
"max_comments": 30,
"has_max_comments": false
},
"jsmeta_data": {
"contribution": {
"type": "loadContent",
"slogitem_id": 695,
"isDiscussion": true
}
},
"improve_data": {
"cc_base_tid": "405",
"cc_history_timestamp": 1663003486,
"min_final_value": 62.99,
"improver_sids": "211;686;689;684;688;687",
"delay_done": 4
}
},
"expire": 1663947909
}
php[Bearbeiten]
<?php
/**
* @file
* Contains \Drupal\sxt_mediawiki\Plugin\Field\FieldType\MwCommentFieldType.
*/
namespace Drupal\sxt_mediawiki\Plugin\Field\FieldType;
use Drupal\sxt_mediawiki\Plugin\Field\FieldType\MediaWikiFieldType;
use Drupal\Core\Field\FieldDefinitionInterface;
/**
* Plugin implementation of the 'sxt_mwcomment' field type.
*
* @FieldType(
* id = "sxt_mwcomment",
* label = @Translation("MW Comment"),
* description = @Translation("This field stores comments in mediawiki format."),
* category = @Translation("Text"),
* default_widget = "sxt_mediawiki",
* default_formatter = "sxt_mediawiki"
* )
*/
class MwCommentFieldType extends MediaWikiFieldType {
/**
* {@inheritdoc}
*/
public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
$values['value'] = self::generateParagraphs(mt_rand(1, 4), self::PARA_TEXT);
return $values;
}
protected static function getParagraphsAvailable() {
return [
self::PARA_TEXT,
self::PARA_ULIST,
self::PARA_ULIST,
self::PARA_OLIST,
self::PARA_OLIST,
self::PARA_DEFLIST,
];
}
}