حقول التصنيفات القابلة للتسلسل
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
تعمل التصنيفات القابلة للتسلسل بالطريقة نفسها تمامًا مثل التصنيفات العادية
باستثناء أنّها تُسلسل أيضًا إلى XML. ولا يجب استخدامها إلا إذا كنت تعدِّل
محتوى تصنيف آليًا وتريد تسلسله إلى ملف XML.
حقل تصنيف قابل للتسلسل

حقل تصنيف قابل للتسلسل في كتلة مصغّرة

الإنشاء
JSON
{
"type": "example_serializable_label",
"message0": "%1",
"args0": [
{
"type": "field_label_serializable",
"name": "FIELDNAME",
"text": "a serializable label"
}
]
}
JavaScript
Blockly.Blocks['example_serializable_label'] = {
init: function() {
this.appendDummyInput()
.appendField(new Blockly.FieldLabelSerializable("a serializable label"), "FIELDNAME");
}
};
يقبل حقل التصنيف القابل للتسلسل قيمة اختيارية وسلسلة css
class اختيارية. يتم ضبط كلا الحقلين تلقائيًا على سلسلة فارغة.
نشر الحلقات على نحو متسلسِل
JSON
يظهر تنسيق JSON لحقل تصنيف قابل للتسلسل على النحو التالي:
{
"fields": {
"FIELDNAME": text
}
}
حيث يكون FIELDNAME
سلسلة تشير إلى حقل تصنيف قابل للتسلسل، و
القيمة هي القيمة التي سيتم تطبيقها على الحقل. تتبع القيمة
القواعد نفسها المتّبعة في قيمة الدالة الإنشائية.
XML
يظهر تنسيق XML لحقل تصنيف قابل للتسلسل على النحو التالي:
<field name="FIELDNAME">text</field>
تحتوي سمة name
الخاصة بعقدة field
على سلسلة تشير إلى حقل
تصنيف قابل للتسلسل، ويكون النص الداخلي للعقدة هو القيمة التي سيتم تطبيقها على الحقل.
أدوات التحقّق
لا تتيح حقول التصنيف القابلة للتسلسل استخدام مدقّقات، لأنّه لا يمكن للمستخدم تعديلها.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eSerializable labels function identically to regular labels but with the added capability of serializing to XML for programmatic content editing.\u003c/p\u003e\n"],["\u003cp\u003eThese labels are defined using JSON or JavaScript, specifying their type, message, arguments, and field name.\u003c/p\u003e\n"],["\u003cp\u003eSerialization of serializable labels is achieved through JSON or XML, representing the field name and its corresponding text value.\u003c/p\u003e\n"],["\u003cp\u003eUnlike regular labels, serializable labels lack validator support due to their non-editable nature.\u003c/p\u003e\n"]]],[],null,["# Serializable label fields\n\nSerializable labels work exactly the same as [normal labels](/blockly/guides/create-custom-blocks/fields/built-in-fields/label)\nexcept they also serialize to XML. They should only be used if you are editing\nthe content of a label programmatically, and wish it to serialize to XML.\n\n#### Serializable label field\n\n#### Serializable label field on a collapsed block\n\nCreation\n--------\n\n### JSON\n\n {\n \"type\": \"example_serializable_label\",\n \"message0\": \"%1\",\n \"args0\": [\n {\n \"type\": \"field_label_serializable\",\n \"name\": \"FIELDNAME\",\n \"text\": \"a serializable label\"\n }\n ]\n }\n\n### JavaScript\n\n Blockly.Blocks['example_serializable_label'] = {\n init: function() {\n this.appendDummyInput()\n .appendField(new Blockly.FieldLabelSerializable(\"a serializable label\"), \"FIELDNAME\");\n }\n };\n\nThe serializable label field takes in an optional value, and an optional css\nclass string. Both default to an empty string.\n\nSerialization\n-------------\n\n### JSON\n\nThe JSON for a serializable label field looks like so: \n\n {\n \"fields\": {\n \"FIELDNAME\": text\n }\n }\n\nWhere `FIELDNAME` is a string referencing a serializable label field, and\nthe value is the value to apply to the field. The value\nfollows the same rules as the constructor value.\n\n### XML\n\nThe XML for a serializable label field looks like so: \n\n \u003cfield name=\"FIELDNAME\"\u003etext\u003c/field\u003e\n\nThe `field` node's `name` attribute contains a string referencing a serializable\nlabel field, and the node's inner text is the value to apply to the field.\n\nValidators\n----------\n\nSerializable label fields do not support validators, because they are not\neditable by a user."]]