Scroll
Kontent Entitet
Ova špric lista sadrži pregled često korišćenih metoda, klasa i interfejsa za objekte sadržaja.
/sites/default/files/drupal-content-entity-8.0.pdf
Sadržajne entitete nasledjuju mnogo svog ponašanja od entiteta. Pogledajte Rad sa Entity API za ove opšte funkcionalnosti.
Upravljanje vrednostima polja
Kreirajte prilagođena polja koristeći metodu baseFieldDefinitions za vaš Content objekat.
- Učitajte instancu prilagođenog objekta u lokalnu promenljivu $Custom_Entity
- Definišite prilagođeno polje pod imenom „custom_field“
- Sačuvajte neke podatke
Primer koda
$custom_field_value = $Custom_Entity->custom_field->value; // Izvršite neku vrstu manipulacije podacima $Custom_Entity->custom_field->value = $custom_field_value; $Custom_Entity->save();
Primeri sadržaja entiteta:
- node
- comment
- user
Source URL:
Drupal’s online documentation is © 2000-2020 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.