Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author David Lingren

    (@dglingren)

    Thank you for your kind words and for your interesting question.

    The current MLA version does not have any hooks for the enhanced meta boxes it adds to the Media/Edit Media screen, but it is a reasonable thing to add. I will do some experimenting and see if I can add the hooks and an example of using them to the next MLA version.

    I will leave this topic unresolved for now and update it when I have progress to report.

    Thanks for the idea and for your patience while I pursue it.

    Thread Starter Anthony Martin

    (@spidlace)

    Very nice ! I wait this update with impatience.

    Thanks you

    Plugin Author David Lingren

    (@dglingren)

    I have completed development of nine new filters that give great control over formatting and displaying the “Edit Media enhanced meta boxes.” I have created an example plugin for the filters and added code to implement the simplified “Inserted in” format you gave in your example. Here is the code for your example:

    /**
         * MLA Inserted in Meta Box Filter
         *
         * This filter gives you an opportunity to modify the "Inserted in" meta box.
         *
         * @since 1.00
         *
         * @param    array    ( [inserts] => default text, [rows] => textbox rows, [cols] => textbox columns )
         * @param    array    the attachment references information for this post
         * @param    object    the current post
         *
         * @return    array    updated text, rows, columns
         */
        public static function mla_inserted_in_meta_box_filter( $inserts, $references, $post ) {
            //error_log( 'MLAMetaboxHooksExample::mla_inserted_in_meta_box_filter $inserts = ' . var_export( $inserts, true ), 0 );
            //error_log( 'MLAMetaboxHooksExample::mla_inserted_in_meta_box_filter $references = ' . var_export( $references, true ), 0 );
            //error_log( 'MLAMetaboxHooksExample::mla_inserted_in_meta_box_filter $post = ' . var_export( $post, true ), 0 );
    
            $new_inserts = array();
            $upload_dir = wp_upload_dir();
            $file_url = $upload_dir['baseurl'] . '/' . $references['base_file'];
            $new_inserts[] = $references['file'];
            $new_inserts[] = '(' . $file_url . ')';
    
            // Index on post ID to eliminate duplicates
            $base_references = array();
            foreach( $references['inserts'] as $key => $file_references ) {
                foreach ( $file_references as $reference ) {
                    $base_references[ $reference->ID ] = $reference;
                }
            }
    
            foreach ( $base_references as $reference ) {
                $new_inserts[] = $reference->post_title;
                $new_inserts[] = '(' . get_permalink( $reference->ID, false ) . ')';
            }
    
            $inserts['inserts'] = implode( "\n", $new_inserts );
            return $inserts;
        } // mla_inserted_in_meta_box_filter

    These improvements will be in my next MLA version. If you’d like to test the improvements, please send me a note with your e-mail address and I will give you a copy by return e-mail. You can use the Contact Us page at our web site:

    Fair Trade Judaica/Contact Us

    Thanks for your help and your patience.

    Thread Starter Anthony Martin

    (@spidlace)

    Hi David,

    Thanks for your answer and your development.

    I send you a email and I’m a hurry to test the new version of this plugin ! 🙂

    Thanks you very much

    Plugin Author David Lingren

    (@dglingren)

    Thank you for following up with your contact information. I hope you received the test copy I sent and were able to use it to format your “Inserted in” meta box.

    I am marking this topic resolved, but please update it if you have any problems or further questions about using the new filters and example plugin to format the Media/Edit Media meta boxes. Thanks for inspiring an MLA enhancement and for your interest in the plugin.

    Thread Starter Anthony Martin

    (@spidlace)

    Hi David,

    Thanks for the copy.
    I test it, and you do a great job for this news hooks !!

    But I have one question.
    It is possible to remove textarea for metabox ? Because, when I want to add some HTML and CSS in this text, I can’t and my tag are visible and not understand by the browser…
    Do you see what I mean ?

    (this is a screenshot for understand my problem)

    http://img4.hostingpics.net/pics/842232mla.png

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Edit box "Inserted in"’ is closed to new replies.