Trying to Get Text Field to Save

I am creating my own options page for a plugin and I am having trouble getting my text field to save. My code looks like this: function setup_fields() { add_settings_field(‘my_first_field’, ‘Field name’, ‘field_callback’, ‘myplugin’, ‘my_first_section’); } add_action(‘admin_init’, ‘setup_fields’); function field_callback($arguments) { echo ‘<input name=”my_first_field” id=”my_first_field” type=”text” value=”‘ . get_option(‘my_first_field’, ‘default’) . ‘” />’; register_setting(‘myplugin’, ‘my_first_field’);…

Arrays not working in my add_options_page

I’m customizing my own options page for a plugin and I have a very basic question about arrays that I’m attempting to input in my add_options_page under the $function. My code looks like this: function myplugin_register_settings() { add_option(‘myplugin_option_name’, ‘Option Value’); register_setting(‘myplugin_options_group’, ‘myplugin_option_name’, ‘myplugin_callback’); } add_action(‘admin_init’, ‘myplugin_register_settings’) function create_plugin_settings_page() { add_options_page(‘Page Title’, ‘Plugin Menu’, ‘manage_options’, ‘myplugin’,…

How to log to console when in a Drupal attach behavior?

I’m using Drupal 7. I have the following code that tries to log to the console: function mymodule_get_jquery() { $jquery = <<<JAVASCRIPT console.log(“here”); (function($) { console.log(“there”); Drupal.behaviors.addHighStockChart = { attach: function(context, settings) { console.log(“everywhere”); /* … */ } // end attach } // end Drupal.behaviors.addHighStockChart }) (jQuery); JAVASCRIPT; return $jquery; } If I open the…

Define an even on select with event observer

My template is located in src/app/design/frontend/MySite/default/Magento_Checkout/templates/cart/item/default.phtml There is a select and in this select I’m adding an event. <select id=”cart-<?= /* @escapeNotVerified */ $_item->getId() ?>-qty” name=”cart[<?= /* @escapeNotVerified */ $_item->getId() ?>][qty]” data-cart-item-id=”<?= $block->escapeHtml($_item->getSku()) ?>” title=”<?= $block->escapeHtml(__(‘Quantity’)) ?>” class=”qty” data-role=”cart-item-qty” data-bind=”event:{ change: qtyChanged}”> Problem is when I load the page checkout/cart/ where the select id, I…