]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Added hook to wrap the notice form data block
authorSarven Capadisli <csarven@status.net>
Mon, 5 Oct 2009 14:17:55 +0000 (14:17 +0000)
committerSarven Capadisli <csarven@status.net>
Mon, 5 Oct 2009 14:17:55 +0000 (14:17 +0000)
EVENTS.txt
lib/noticeform.php

index fbb2f36a7b81ff2987213cdaecca53749bae31a4..02b11a8a6772db26a76e620c672bbf937a6e0c69 100644 (file)
@@ -93,6 +93,12 @@ StartShowAside: Showing before the Aside container
 EndShowAside: Showing after the Aside container
 - $action: the current action
 
+StartShowNoticeFormData: Showing before the notice form data
+- $action: the current action
+
+EndShowNoticeFormData: Showing after the notice form data
+- $action: the current action
+
 StartNoticeSave: before inserting a notice (good place for content filters)
 - $notice: notice being saved (no ID or URI)
 
index 186330bf1c783f430449ff046b0f2d79d1ada9ca..9864d15eb084dfb18fe4df869dddf25ef8ad2cc9 100644 (file)
@@ -142,40 +142,44 @@ class NoticeForm extends Form
 
     function formData()
     {
-        $this->out->element('label', array('for' => 'notice_data-text'),
-                            sprintf(_('What\'s up, %s?'), $this->user->nickname));
-        // XXX: vary by defined max size
-        $this->out->element('textarea', array('id' => 'notice_data-text',
-                                              'cols' => 35,
-                                              'rows' => 4,
-                                              'name' => 'status_textarea'),
-                            ($this->content) ? $this->content : '');
-
-        $contentLimit = Notice::maxContent();
-
-        $this->out->element('script', array('type' => 'text/javascript'),
-                            'maxLength = ' . $contentLimit . ';');
-
-        if ($contentLimit > 0) {
-            $this->out->elementStart('dl', 'form_note');
-            $this->out->element('dt', null, _('Available characters'));
-            $this->out->element('dd', array('id' => 'notice_text-count'),
-                                $contentLimit);
-            $this->out->elementEnd('dl');
+        if (Event::handle('StartShowNoticeFormData', array($this))) {
+            $this->out->element('label', array('for' => 'notice_data-text'),
+                                sprintf(_('What\'s up, %s?'), $this->user->nickname));
+            // XXX: vary by defined max size
+            $this->out->element('textarea', array('id' => 'notice_data-text',
+                                                  'cols' => 35,
+                                                  'rows' => 4,
+                                                  'name' => 'status_textarea'),
+                                ($this->content) ? $this->content : '');
+
+            $contentLimit = Notice::maxContent();
+
+            $this->out->element('script', array('type' => 'text/javascript'),
+                                'maxLength = ' . $contentLimit . ';');
+
+            if ($contentLimit > 0) {
+                $this->out->elementStart('dl', 'form_note');
+                $this->out->element('dt', null, _('Available characters'));
+                $this->out->element('dd', array('id' => 'notice_text-count'),
+                                    $contentLimit);
+                $this->out->elementEnd('dl');
+            }
+
+            if (common_config('attachments', 'uploads')) {
+                $this->out->element('label', array('for' => 'notice_data-attach'),_('Attach'));
+                $this->out->element('input', array('id' => 'notice_data-attach',
+                                                   'type' => 'file',
+                                                   'name' => 'attach',
+                                                   'title' => _('Attach a file')));
+                $this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota'));
+            }
+            if ($this->action) {
+                $this->out->hidden('notice_return-to', $this->action, 'returnto');
+            }
+            $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto');
+
+            Event::handle('StartShowNoticeFormData', array($this));
         }
-
-        if (common_config('attachments', 'uploads')) {
-            $this->out->element('label', array('for' => 'notice_data-attach'),_('Attach'));
-            $this->out->element('input', array('id' => 'notice_data-attach',
-                                               'type' => 'file',
-                                               'name' => 'attach',
-                                               'title' => _('Attach a file')));
-            $this->out->hidden('MAX_FILE_SIZE', common_config('attachments', 'file_quota'));
-        }
-        if ($this->action) {
-            $this->out->hidden('notice_return-to', $this->action, 'returnto');
-        }
-        $this->out->hidden('notice_in-reply-to', $this->inreplyto, 'inreplyto');
     }
 
     /**