Forum Replies Created

Viewing 15 replies - 16 through 30 (of 184 total)
  • Forum: Plugins
    In reply to: [CMB2] Columns within row?
    Thread Starter dkurth

    (@dkurth)

    Understood. I appericate your help as it is.

    As for my own rendering, been down that road for creating separate field types. If I were to ever go there again, it would be to write my own version of your system and that seems like a heavy road for some formatting issues.

    Primary difference between what I would do and what you team has done, is I would not assume data should be placed in the WordPress database. I would also remove the need to import images via the WordPress media system…or at the very least, make it an option. Would be nice just to upload to a independent directory and not impact the WordPress database.

    Your tool did the job for what needed, even if I had to find ways around it at times. I appreciate everything you have done.

    Forum: Plugins
    In reply to: [CMB2] Columns within row?
    Thread Starter dkurth

    (@dkurth)

    Having done quite a bit of CSS, including changing CMB2 (hiding buttons, displaying others), it is only as good as the <div> within the code. The css is just the class what the DIV references, thus the code would have to be changed in order to define it..thus the problem.

    Difference between this:
    <div>THE ROW AND </DIV>

    and this
    <div><div class="column1"><div class="column2"><div>

    Seems like doing my own render, would mean redoing the render for all the fields as well..or am I missing something, that you know, that I do not?

    Forum: Plugins
    In reply to: [CMB2] Columns within row?
    Thread Starter dkurth

    (@dkurth)

    that would be a bit more complicated in that i would not want to replicate all the fields rendering.

    any other thoughts ?

    Forum: Plugins
    In reply to: [CMB2] THEORY QUESTION…
    Thread Starter dkurth

    (@dkurth)

    sure.

    I broke up the record set by creating separate custom posts. Each unique custom posts also contains a unique cmb2 identifiers. Each post types are associated with unique record types.

    Since i use the override callbacks to load the cmb2 fields with database data, and the reverse for saving data, I can define these records split by the post id, even if they exist within the same table.

    Be happy to share equivalent code, should someone desire to do similar.

    Thread Starter dkurth

    (@dkurth)

    skipped this as there is no secure way.

    Forum: Plugins
    In reply to: [CMB2] THEORY QUESTION…
    Thread Starter dkurth

    (@dkurth)

    found another way

    Thread Starter dkurth

    (@dkurth)

    found a way to do it using separate custom posts.

    Thread Starter dkurth

    (@dkurth)

    sorry for the delay, took a slightly different route by setting up separate custom post types that pull records from the database based on type verses one combined. If I still need this, I will get back to you…will post another question different subject.

    I am a user…what in the heck are you talking about. Works great..including the email. Try checking conflicting css and javascript names.

    Thread Starter dkurth

    (@dkurth)

    …too large. Each record is VERY big.

    Thread Starter dkurth

    (@dkurth)

    ok, that is what I needed to know…what are the functions called.

    Here is what I am doing. I have hundreds of records in one list type that I am filling in the fields via override and database retrieval of information. (works great btw). BUT, when the number of records gets large and the size of each record is equally large, I want to limit the number of records that are displayed on the back end at any one time, yet still give access to the full list. Instead of say 150, display only 10 at a time.

    Using a cookie, I will keep track of the “top of the list” and know where to start loading the data from, in the database. The buttons would execute two items, the top of the list being displayed AND force the custom data callback to be re-executed.

    add_filter('cmb2_override_MMDListsRecord_meta_value', 'mmd_get_methods_custom_data', 10, 4);
    function mmd_get_methods_custom_data( $dont_override, $PostId,  $args, $cmb2_field_object )
    

    It is this last stage, to force the override call to be executed again, that I need assistance with…unless I just call it. (Have not tried that yet).

    The goal is to reduce the memory load for each of the lists that I am displaying in the admin section. The front end is no problem, since that is per account and will be just a few listings at a time. But the admin, can take upwards of 2 minutes to load..it is that large.

    • This reply was modified 5 years, 5 months ago by dkurth.
    Thread Starter dkurth

    (@dkurth)

    Interesting…found it in a different file (CMB2.php) Can you tell me what that other function is for? And since I normally use a ‘onclick’ feature and do not see that in the function below, can you educate me or point me to how this ‘data-selector feature appears to work? That is totally new.

    	public function render_group_callback( $field_args, $field_group ) {
    
    		// If field is requesting to be conditionally shown.
    		if ( ! $field_group || ! $field_group->should_show() ) {
    			return;
    		}
    
    		$field_group->index = 0;
    
    		$field_group->peform_param_callback( 'before_group' );
    
    		$desc      = $field_group->args( 'description' );
    		$label     = $field_group->args( 'name' );
    		$group_val = (array) $field_group->value();
    
    		echo '<div class="cmb-row cmb-repeat-group-wrap ', esc_attr( $field_group->row_classes() ), '" data-fieldtype="group"><div class="cmb-td"><div data-groupid="', esc_attr( $field_group->id() ), '" id="', esc_attr( $field_group->id() ), '_repeat" ', $this->group_wrap_attributes( $field_group ), '>';
    
    		if ( $desc || $label ) {
    			$class = $desc ? ' cmb-group-description' : '';
    			echo '<div class="cmb-row', $class, '"><div class="cmb-th">';
    			if ( $label ) {
    				echo '<h2 class="cmb-group-name">', $label, '</h2>';
    			}
    			if ( $desc ) {
    				echo '<p class="cmb2-metabox-description">', $desc, '</p>';
    			}
    			echo '</div></div>';
    		}
    
    		if ( ! empty( $group_val ) ) {
    			foreach ( $group_val as $group_key => $field_id ) {
    				$this->render_group_row( $field_group );
    				$field_group->index++;
    			}
    		} else {
    			$this->render_group_row( $field_group );
    		}
    
    		if ( $field_group->args( 'repeatable' ) ) {
    			echo '<div class="cmb-row"><div class="cmb-td"><p class="cmb-add-row"><button type="button" data-selector="', esc_attr( $field_group->id() ), '_repeat" data-grouptitle="', esc_attr( $field_group->options( 'group_title' ) ), '" class="cmb-add-group-row button-secondary">', $field_group->options( 'add_button' ), '</button></p></div></div>';
    	
    		}
    
    		echo '</div></div></div>';
    
    		$field_group->peform_param_callback( 'after_group' );
    
    		return $field_group;
    	}
    
    • This reply was modified 5 years, 5 months ago by dkurth.
    Thread Starter dkurth

    (@dkurth)

    Just a FYI, I have been trying to modify the code in CMB2_Types, line 344, just to duplicate the same button and it function, just displaying 2 buttons instead of one. It is within the function

    	public function render_repeatable_field() {
    		$table_id = $this->field->id() . '_repeat';
    
    		$this->_desc( true, true, true );
    		?>
    
    		<div id="<?php echo $table_id; ?>" class="cmb-repeat-table cmb-nested">
    			<div class="cmb-tbody cmb-field-list">
    				<?php $this->repeatable_rows(); ?>
    			</div>
    		</div>
    		<p class="cmb-add-row">
    			<button type="button" data-selector="<?php echo $table_id; ?>" class="cmb-add-row-button button-secondary"><?php echo esc_html( $this->_text( 'add_row_text', esc_html__( 'Add Row', 'cmb2' ) ) ); ?></button>
    		</p> <strong>this is a test<br />   << ===== I ADDED THIS</strong>
    		<?php
    		// reset iterator
    		$this->iterator = 0;
    	} 

    But nothing displays and I honestly, at this point, do not know why. No where else seems to have the same class calls.

    What am I missing?

    Thread Starter dkurth

    (@dkurth)

    I can put a debug statement in it to test. But it is connected to the callback hook and i have it another name.

    Thread Starter dkurth

    (@dkurth)

    I tried adding just simple text to the field area..that is what confused me, since nothing would display..simple

     
    echo "test message";
    

    Right under the button..nada.

Viewing 15 replies - 16 through 30 (of 184 total)