| 773 | | |
|---|
| | 773 | |
|---|
| | 774 | /** |
|---|
| | 775 | * Include all text/css attachments of current style to MidCOM headers |
|---|
| | 776 | */ |
|---|
| | 777 | function add_database_head_elements() |
|---|
| | 778 | { |
|---|
| | 779 | static $called = false; |
|---|
| | 780 | if ($called) |
|---|
| | 781 | { |
|---|
| | 782 | return; |
|---|
| | 783 | } |
|---|
| | 784 | $style = new midcom_db_style($_MIDGARD['style']); |
|---|
| | 785 | $mc = midcom_baseclasses_database_attachment::new_collector('parentguid', $style->guid); |
|---|
| | 786 | $mc->add_constraint('mimetype', '=', 'text/css'); |
|---|
| | 787 | $mc->add_value_property('name'); |
|---|
| | 788 | $mc->execute(); |
|---|
| | 789 | $attachments = $mc->list_keys(); |
|---|
| | 790 | |
|---|
| | 791 | foreach ($attachments as $guid => $values) |
|---|
| | 792 | { |
|---|
| | 793 | // TODO: Support media types |
|---|
| | 794 | $filename = $mc->get_subkey($guid, 'name'); |
|---|
| | 795 | $_MIDCOM->add_link_head |
|---|
| | 796 | ( |
|---|
| | 797 | array |
|---|
| | 798 | ( |
|---|
| | 799 | 'rel' => 'stylesheet', |
|---|
| | 800 | 'type' => 'text/css', |
|---|
| | 801 | 'href' => "{$_MIDGARD['self']}midcom-serveattachment-{$guid}/{$filename}", |
|---|
| | 802 | ) |
|---|
| | 803 | ); |
|---|
| | 804 | } |
|---|
| | 805 | |
|---|
| | 806 | $called = true; |
|---|
| | 807 | } |
|---|