texts: Updating module using _update_n not appearing on update.php or in /modules/update

texts:
I had to change the schema of a module I created. I added a function like this:

function cloudinary_update_7200() {

  $spec = array(
    'keywords' => array('type' => 'longtext', 'not null' => FALSE),
    'primaryImage' => array('type' => 'tinyint', 'default' => 1, 'not null' => FALSE)
  );

  $cloudinary_field_table = 'field_data_field_cloudinary';
  $revision_table_name = 'field_revision_field_cloudinary';

  $keywords = 'field_cloudinary_keywords';
  db_add_field($cloudinary_field_table, $keywords, $spec);
  db_add_field($revision_table_name, $keywords, $spec);

  $primaryImage = 'field_cloudinary_primaryImage';
  db_add_field($cloudinary_field_table, $primaryImage, $spec);
  db_add_field($revision_table_name, $primaryImage, $spec);

  //UPDATE FIELDS
  $description_spec = array(
    'description' => array('type' => 'longtext', 'not null' => FALSE)
  );
  db_change_field($cloudinary_field_table, "field_cloudinary_alt", "field_cloudinary_description", $description_spec);

}

So how do I get it to run? I've gone to /update.php but nothing. I tried /admin/modules/update and the module is not listed.

Yes, I have cleared my cash many many times. And yes, I've cleared it again.


texts: I've been asked to support a drupal website. The website has a block that has content in it. When I locate the block in /admin/structure/block/block-content, the "block body" section is empty. I am at loss and have no idea where to find the block content. I have no access to the database to edit the block content directly there.


texts: How to hide/remove "Request New password" link in Drupal 7?

texts:
I am using 'Login Block' to access Intranet pages from our website. I used 'Login Block' on www.example.com/common-intra
 page to login into intranet section.

I am using userprotect module to hide profile/username/password information from the users when they logged in into Intranet section (www.example.com/common-intra) with universal account.

But, I wanted to hide/remove "Request New password" link from Intranet Login page:

I found this module, haven't used yet though:
https://www.drupal.org/project/noreqnewpass

Is there any other easy way to just hide "Request New password" link from that Intranet Login page?

I still want this tab on general login page such as:
www.example.com/user
 But, I just want to hide it from the www.example.com/common-intra page.

I also tried to hide it with css.

This is my page source code:

        <form action="/common-login?destination=node/16" method="post" id="user-login-form" accept-charset="UTF-8">

      Username *

     <input type="text" id="edit-name" name="name" value="" size="15" maxlength="60" class="form-text required" />

  Password *

 <input type="password" id="edit-pass" name="pass" size="15" maxlength="128" class="form-text required" />

Request new password

<input type="hidden" name="form_build_id" value="form-_xyzabc" />

<input type="submit" id="edit-submit" name="op" value="Log in" class="form-submit" />

</form>

I gave class name 'common-intra' to user login block to my node template.

.common-intra ul li{
    display: none;
}

I also tried:

.panel-pane pane-block pane-user-login common-intra pane-user common_login_button ul li
    {
          display: none;
    }


texts: Programmatically building a Quicktabs instance

texts:
What I need to do is merge the usermenu ( user tasks ) with a Quicktabs menu I have on the same page.

So what I'm trying to do at the minute is to programmatically build a Quicktabs instance.

Based on the infomation at https://www.drupal.org/node/2119625  I have created a module 'userquicktabs'  heres the .module . Ive enabled the module, and I take it after this I should be able to see a new instance with the others instances I've created in the Quicktabs UI.  Do I need to make a block for the instance?

<?php

function userquicktabs() {
$tabs = array(
$tabs[] = array(
  'title'   => t('Node 1'),
  'type'    => 'node',
  'nid'     => '1',
  'weight'  => 0,
),
$tabs[] = array(
  'title'   => t('Node 2'),
  'type'    => 'node',
  'nid'     => '2',
  'weight'  => 1,
),
);

 // Configure the QuickTabs options
 $quicktabs_options = array(
'style'   => 'commons',
'ajax'    => FALSE,
'renderer'    => 'quicktabs',
);

$quicktabs_name = 'newinstance';

 print drupal_render(quicktabs_build_quicktabs($quicktabs_name, $quicktabs_options, $tabs));

}


texts: Drupal recommended-project missing Drush

texts:
I am looking to transform from drupal-project to recommended-project and seeing  some difference in the folder structure.

drupal-project contains a drush folder outside'web' folder and  'composer.json' contains line "drush/drush": "^9.0.0".

However, recommended-project does not have this setup although I could still install drush using composer require drush/drush. Still drush isn't installed outside 'web' folder.

Can I please know why the setup has changed and a way to have drush folder outside 'web'?


texts: Flag module not joining flagging with EntityFieldQuery?

texts:
I'm using EntityFieldQuery to pull nodes based on a flag created with the Flag module (3.2):

  $query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'node')
    ->entityCondition('bundle', 'article')
    ->propertyCondition('status', 1)
    ->range(0, 25)
    ->addTag('flagging_flag_names')
    ->addMetaData('flag_name_value', 'my_flag_name');

I'm not seeing the flagging table being joined to the query (from the error being thrown):

Unknown column 'flagging.fid' in 'on clause':
SELECT node.nid AS entity_id, node.vid AS revision_id, node.type AS bundle, 'node' AS entity_type FROM node node INNER JOIN flag f ON flagging.fid = f.fid WHERE (node.status = 1) AND (node.type = 'article') AND (f.name = 'my_flag_name') LIMIT 25 OFFSET 0

Below is the flag_query_flagging_flag_names_alter from the flag module file:

function flag_query_flagging_flag_names_alter(QueryAlterableInterface $query) {
  // Get value and operator for bundle condition from meta data.
  $value = $query->getMetaData('flag_name_value');
  $operator = $query->getMetaData('flag_name_operator');
  // Join [flag] and [flagging] tables by [fid] and
  // apply bundle condition on [flag].[name] field.
  $query->join('flag', 'f', 'flagging.fid = f.fid');
  $query->condition('f.name', $value, $operator);
}

What am I missing in the query build to join the flagging table?


texts:
I'm a Drupal 8 newbie writing my first module. I have a functioning yet basic module to learn from. What I'm working on now is for it to get a value from a configuration page. If I go directly to the URL for the custom config page it works. What I'm having trouble with is getting a link to my custom config page to display on the main config page. I've been through every tutorial I can find on this topic and I just can't figure out why it's not working. I hope you all can help. Here's my yml files.

itemrequest.info.yml

name: Item Request
type: module
description: Allow the public to request items for the District to purchase.
package: YCFLD
core: 8.x
configure: itemrequest.settings

itemrequest.routing.yml

itemrequest.itemrequest:
  path: '/itemrequest'
  defaults:
    _controller: '\Drupal\itemrequest\Controller\ItemrequestController::itemrequestpage'
    _title: 'Request an Item'
  requirements:
    _permission: 'access content'
itemrequest.settings:
  path: '/admin/config/itemrequest/settings'
  defaults:
    _form: '\Drupal\itemrequest\Form\ItemrequestForm'
    _title: 'Item Request'
  requirements:
    _permission: 'access administration pages'
  options:
    _admin_route: TRUE

itemrequest.links.menu.yml

itemrequest.settings:
  title: 'Item Request Form'
  description: 'Settings for Item Request form"
  route_name: itemrequest.settings
  parent: system.admin_config

Do see anything wrong in the .yml files? Is there anything I can do to troubleshoot this?


texts: Conflict with Vertical tabs module when inserting a jwyswiyg editor

texts:
We have created a custom module to control/insert the jwysiwyg editor onto text areas. We would use wysiwyg module, however, we had conflicts with regards to custom plugins.

Everything is working great, except there is a conflict with vertical tabs which causes jwysiwyg editor buttons to repeat themselves several times. I have verified that this is due to VT, as the duplications disappear once VT is disabled.

I suspect it has something to do with drupal behaviors or attachbehaviors being called multiple times. However stack trace in attachbehaviors and in my custom jywsiwyg code doesn't reveal multiple calls. I'm at a dead end.

Here is my jwysiwyg javascript insert code:

(function($) {

Drupal.jwysiwyg = Drupal.jwysiwyg || {};
Drupal.behaviors.jwysiwyg = function() {
  var default_settings = {
    iFrameClass: "jwysiwyg",
    initialContent: "",
    rmUnusedControls: true,
    autoSave: true,
    controls: {
      fileManager: {
        visible: true,
        groupIndex: 12,
        tooltip: "Insert images",
        exec: function () {
          $.wysiwyg.fileManager.setAjaxHandler(Drupal.settings.jwysiwyg.url);
          $.wysiwyg.fileManager.init(this);
        }
      }
    }
  };

  $('.jwysiwyg:not(.jwysiwyg-processed)').each(function() {
    var $this = $(this).addClass('jwysiwyg-processed');
    var params = Drupal.jwysiwyg.getParams(this);

    if (($this.is(':input') && $this.is(':checked')) || $this.is('div')) {
      if (params.status == 1) {
      var settings = $.extend(true, default_settings, Drupal.settings.jwysiwyg[params.format]);
        $("#" + params.field).wysiwyg(settings);
      }
    }
    // Attach onChange handlers to input format selector elements.
    if ($this.is(':input')) {
      $this.change(function() {
        $("#" + params.field).wysiwyg('destroy');
        if (params.status == 1) {
          var settings = $.extend(true, default_settings, Drupal.settings.jwysiwyg[params.format]);
          $("#" + params.field).wysiwyg(settings);
        }
      });
      // IE triggers onChange after blur only.
      if ($.browser.msie) {
        $this.click(function () {
          this.blur();
        });
      }
    }
  });
};

clicking b/w input formats resolves the problem.

Any suggestions are greatly appreciated!


texts: Exposed date filter adds a timezone offset in query

texts:
In Drupal 8, when creating a view with an exposed filter on a Date field (which is in date only mode), the resulting query removes some hours based on my timezone.

I'm in the UTC+2 timezone, so a date filter of 2016-04-20 creates a query of DATE_FORMAT('2016-04-19T22:00:00', '%Y-%m-%d'). And so, none of the nodes I want are displayed...

How to avoid that?


texts:
I have a site where search is based on Search API (mysql server). I have two fields in my content type (brand and model) and I have created two faced block based on these fields. They work.

Now I want to make visible the model's facet block only when users have chose the brand (from the faced block).

Is this possible without a custom module or PHP code that searches in $_GET the brand chosen from the users?


texts: Can pathauto aliases be applied to taxonomy menu blocks?

texts:
I have got the taxonomy alias patterns working but for some reason my taxonomy menu block is not using them.

Is there something I need to do/enable/kill/worship to get a taxonomy menu block to respect the taxonomy aliases generated by path auto?


texts: How to display vocabulary terms and their descriptions with their tagged content in a view?

texts:
Say I have two terms in a vocabulary, and I want to display their titles and descriptions, along with a list of nodes which have been tagged. Here's an example:

Page Title: Services

Term Name: Medical
Term Description: We're the best doctors in town!
Content tagged with term: Brain Surgery, Leg Amputation

Term Name: Business
Term Description: We'll make you rich!
Content tagged with term: Accounting, Management, Bookkeeping, Strategy

How could I accomplish this using Views in Drupal 7?

I've tried creating a term view, adding the term name and term description fields, enabling a relationship for 'Content with Term', adding a field for 'Content: Title', and grouping by Term name with 'Use rendered output to group rows' disabled, but I still get a ton of duplicates.

Any way to resolve this?

Debunked Methods:

Use aggregation! - Nope, this results in something like this (not what we're after here):

Term Name: Medical
Term Description: We're the best doctors in town!
Content tagged with term: Brain Surgery

Term Name: Medical
Term Description: We're the best doctors in town!
Content tagged with term: Leg Amputation

Use the Views Distinct module! - Nope, nothing here seems to work either.

Update

Jimmy's Answer works well for my situation. Alternatively, I also believe that creating a custom display for your taxonomy and developing a field that displays related content based on TID could circumvent your need for views at all. If you're desperate and less paranoid about logic-less templates, you could do that heavy lifting in your theme (don't do this).


texts: Javascript & Ajax failed to load on many pages like field editing & views editing pages.

texts:
The site I'm managing is runs by Drupal 7.53 with many contributed modules.

I don't know what happened from yesterday, ajax queries in field editing pages and views editing pages throwing errors or not loading at all. Clearly I can see what is causing this error in JQuery and Ajax.
All the modules installed are contributed modules except one custom module, which doesn't have any Javascript code in it. Cleared the cache few times . No javascript and CSS aggregation. But still wherever JQuery & Ajax is needed , the pages are breaking . How can I solve this problem. How can I figure out what is causing problem?

I'm unable to alter any of the views due to ajax error throwing up.
All help is appreciated.


texts: How to display a newly created node (created using a form) in the view using ajax (without page reload)?

texts:
I have created a "Share update" form using form API. Below the form, I am displaying a view "feeds" of all the published nodes of content type "updates". On submit, the form saves the data entered in the form as a node of content type "updates". It reloads the page and displays the recently saved node in the view below the form.

I want the node to appear in the view list without page reload. How to do that?

My form API code looks like this -

function add_update_page($form, &$form_state) {
  $form = array(
   '#prefix' => '
',
   '#suffix' => '
',
   '#title' => t('Latest update:'),
   '#description' => t('Add status update'),
  );

  $form['update'] = array(
    '#title' => t('Share an update...'),
    '#type' => 'textarea',
    '#resizable' => '0',
    '#format' => 'update_feed_text',
    '#label' => t('Share an update...'),
  );

  $form['submit'] = array(
    '#id' => 'update-submit-button',
    '#type' => 'submit',
    '#default_value' => t('Share'),
  );
  return $form;
}

function add_update_page_submit($form, &$form_state) {
  $update = $form_state['values']['update'];
  $node = new stdClass();
  $node->type = 'updates';
  node_object_prepare($node);
  $node->status = 1;
  $node->uid = $GLOBALS['user']->uid;
  $node->language = LANGUAGE_NONE;
  $node->created = time();
  $node->changed = $node->created;
  $node->title = 'Automatic status update';
  $node->body[$node->language][0]['value']   = $form_state['values']['update'];
  $node->body[$node->language][0]['summary'] = "";
  $node->body[$node->language][0]['format']  = 'filtered_html';
  node_save($node);
  drupal_set_message($form_state['values']['update']);
  $form_state['redirect'] = '<front>';
}

I have looked up everywhere, but the proposed solutions are incomplete, making it harder to follow the logic.


texts:
What is the corresponding alternative in Drupal 7 for the following query

SELECT row_id,name,email, COUNT(name) AS name_count
FROM tn_api_users
GROUP BY name
HAVING  (name_count > 1)


texts: can any one suggest the custom script to migrate the contents,views and content types from D5 to D7. We already tried with normal conversion process like d5=>d6=>d7 but we facing many errors and contents and views are not imported correctly.


texts: How to specify default formatter for custom field widget?

texts:
I created a custom field widget implementing hook_field_widget_info(), created a custom formatter implementing hook_field_formatter_info() and also implemented hook_field_formatter_view() to generate the formatter's display.

Everything works as intended (validation, persisting values, formatter) with one glaring exception: I can't figure out how to make my widget use my formatter by default.

Every time I add a an iToggle field I need to manually change its formatter in Manage Displays for that content type.

Any ideas?

Here's my code:

function itoggle_field_field_widget_info() {
 return array(
   'itoggle' => array(
    'label' => t('iToggle Widget'),
    'field types' => array('list_boolean'),
    'settings' => array('display_label' => 1),
    'behaviors' => array(
      'multiple values' => FIELD_BEHAVIOR_CUSTOM,
    ),
  ),
);
}

function itoggle_field_field_formatter_info() {
  return array(
    'itoggle' => array(
    'label' => t('iToggle Widget'),
    'description' => t('Displays the field as an iToggle Widget'),
    'field types' => array('list_boolean'),
  ),
);
}

Thanks!


texts: How to load a apache solr document and send it for reindex after editing is done in drupal 7

texts:
As title says,

I want to load a particular node's document and When the editing is done, I need to send the modified document to Solr for re-index programtically.

How it can be done?


texts: How to exclude current page from Views results when "taxonomy term ID (with depth)" is set?

texts:
I have a Views block that has the intention to display all nodes that share the same parent term.

For example:

Queensland

Cairns
Brisbane
Gold Coast
Port Douglas

If I'm on the Cairns page, then it will show all the children of Queensland. The problem with this is, I need to exclude Cairns, as I'm already on this page.

I already tried the solution from "How to list similar products using views in Commerce Kickstart?", but it didn't work. I had an issue where the query preview wouldn't even show, even though I entered the term ID to attempt to get the query.

Any ideas why this would happen?

Notes:

I already entered the term ID to update the preview, but it didn't show anything. If I take the nid filter out, then it works fine, with the caveat that it shows the current page in the results.
I notice something weird where checking exclude in the nid contextual filter shows all the results including Cairns, yet when I uncheck it, then all the results disappear. Is there a reason this would happen?


texts:
I have module, that should build form. However it is not showing form.

There is my code:

function weblabs_form() {
    $form = array();

$form['name']=array(
    '#type'=>'textfield',
    '#title'=>t('Enter your name'),
    '#description'=>t('Your first name goes here')
);
$form['last_name']=array(
    '#type'=>'textfield',
    '#title'=>t('Enter your Last name'),
    '#description'=>t('Your Last name goes here')
);

$form['email']=array(
    '#type'=>'textfield',
    '#title'=>t('Enter your email'),
    '#description'=>t('Your email goes here')
);

$form['country']=array(
    '#type'=>'select',

       '#title'=>t('Select your country'),
        '#options'=>array('USA','UK','France','Japan')
    );

    $form['submit']=array(
        '#type'=>'submit',
        '#value'=>t('Submit')
    );

    return $form;
}

function weblabs_form_submit($form, &$form_state){
    echo("
TEST
");
    drupal_set_message("TEST");
}

function weblabs_menu() {
    $items['calculator'] = array(
        'title' => 'Kalkulačka WebLabs',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('weblabs_form'),
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
        );
    return $items;
}`


texts: Is it okay to use drupal_goto() from within a node?

texts:
I implemented a node that automatically adds a product to a cart using this function uc_cart_add_item(33);

but I want it to then redirect the visitor to the check out page.  I saw that drupal has a drupal_goto() function however this is essentially just a php Header(location: http://mysite.com/cart/checkout)  which usually shouldn't work if it is not done so before any content is spit out.

Now I got this to work and everything but I never liked the idea of just getting it to work, I'd like to get it right.  I thought of a script outside of the drupal environment but wasnt sure if I could use the ubercarts functions.  Does anyone have any ideas on a better way or is the using drupal_goto() within a node okay?

Just to say and I saw someone else who had a similar problem was that this did work, however the cron job time exceeded the time limit after I implemented this.  SO maybe not a good option like i thought.


texts: list all used & unused views in site or panels, as a site audit

texts: Is there a way to list all used & unused views in site? or in panels? (as fields are listed in /admin/reports/fields). I have some complex sites with a lot of views (pages, blocks, entityreference, panes, etc.) and panels pages. While building a site we all make views to test something, then clone view, etc. at the end i may have a lot of unused views, i'm trying to delete unused views to clean site, all my views are rendered inside a panel page. I run D7, but i think this will be helpfull also in D8


texts:
I'm try to overwrite the menu.html.twig file to support my menu structure.

My menu has some links and sublinks (only one level deep). Now when I write the menu.html.twig file I only to all the root links. No subitems can be found.

Can someone tells me what I'm doing wrong?

My source code of menu.html.twig looks like:

{% import _self as menus %}

{% for item in items %}

{% if item.below | length == 0 %}

    {{link(item.title, item.url)}}

{% else %}

 item.title

      {% for subItem in item.below %}

{{link(subItem.title, subitem.url)}}}

      {% endfor %}

{% endif %}

{% endfor %}

My menu structure in Drupal looks like:


texts: How to translate strings available in JS library?

texts:
I'm showing some images on my site where those are displayed using jquery.magnific-popup.min.js library. I'm not able to translate a string in that library. i.e.

  "%curr% of %total%"

It is not searchable even in the translate interface. How can I translate it?


texts: Is registering the path 'node/%/ajax' bad practise?

texts:
Would anyone say that registering the path 'node/%/ajax' would be bad practise, potentially causing trouble for other modules that takes the easy path to implement AJAX functionality on node links?

I've got a node type which has a lot of AJAX functionality, and it would be an easy and obvious solution to simply handle AJAX callbacks via this link as Drupal does all the work for me on links such as 'node/19/nojs' where 'nojs' would be replaced by 'ajax'. Fallback to non-js browser would be taken care of by itself.

My concern is that it might be stupid to "occupy" this path for a single node type, and that it is a too obvious path to occupy with regards to other modules?


texts: Address book problem when user edit the billing address

texts:
i just installed commerce address book module but i noticed that when authenticated users try to edit their billing address they have some options in the bottom that seems very strange and not necessary.

The fist one is : The user is able to change the owner of the account
and the second is : The user can change the status from active to disabled.

I think that these options should not be there.

Do you know how can i disable?


texts: Omega Theme: how to change the stacking order of each region for each layout?

texts:
I´m starting my first theme with Omega. I´ve read the documentation, and managed to understand how it works.
My problem here is that I don´t know how to stack regions in different order for each layout.
I know that I can hide some regions with css and the different css files provided by the omega subtheme, but how to change the order?

Let me explain with an example:

I have this in my wide and tablet (normal) layout:

  HEADER SECTION:

  User Bar First -- User Bar Second -- Branding

  CONTENT SECTION: ...

  FOOTER SECTION: ...

For my mobile version I have this:

  HEADER SECTION:

  User Bar First

  User Bar Second

  Branding

  CONTENT SECTION: ...

  FOOTER SECTION: ...

And I want it to be:

  HEADER SECTION:

  User Bar First

  CONTENT SECTION: ...

  User Bar Second

  Branding

  FOOTER SECTION: ...

Any idea on how to do that?
Thanks!


texts: Create a view to display the list of content created by user and any published content

texts:
I am creating view for displaying content list and some exposed filters. I wanted to display all published content of any user and all content created by user(current user).
Currently i am able to display only own content list by using contextual filter:

Click "Advanced" > "Contextual Filters"
"Add" > "Content: Author uid"
"Provide default value" > "User ID from logged in user"
Save

How can i display in list a combination of All published contents from all authors + published and unpublished contents of logged in user?


texts:
I am unable to  use inline css in ckeditor wyswig for full html . In Allowed HTML tags i have added  but the tag "style" get removed in ckeditor and appears as  in finally render of the page  .how can i get  be rendered.

I am trying to use Content  but it appears as Content.


texts: What can I do to remove this entity definition from the database?

texts:
Long story short, in developing a website in Drupal 8 we decided that the custom entity we were building could just as easily be made with standard nodes. We deleted the entity code (or something to that effect) and now, somewhere hidden in the database, is the definition for the team entity that we've removed. Fortunately, this isn't causing too many issues. However, when deleting fields from a content type (and probably in some other circumstances of which I'm not yet aware), we get the following error:

Drupal\Component\Plugin\Exception\PluginNotFoundException: The "team" entity type does not
exist. in Drupal\Core\Entity\EntityTypeManager->getDefinition() (line 133 of
[...]/core/lib/Drupal/Core/Entity/EntityTypeManager.php).`

I've attempted doing what was suggested here, but it resulted in the above error.

What can I do to clean up the database/website so this error stops happening?


texts: Conditional statement in custom template file using Display Suite

texts:
I've been searching and scratching my head for a while on this one. I'm working on a blog page where the user can tag posts, but it is not required. I only want to output the label 'Category' if tags actually exist, so I need a conditional statement in my node template but I can't figure out the correct logic for doing so. This is what I have so far...

<?= if (isset($node->$content['tags'][0]['value'])): ?>

<?= t("Category"); ?>

<?= render($content['tags']); ?>

<?= endif; ?>

This code gives the following PHP error referring to the first line of the block of code

PHP Parse error:  syntax error, unexpected T_IF

I'm a Drupal novice so I'm expecting it to be something simple that I am missing or potentially just completely the wrong code.


texts:
I want to change the default empty node content of my Drupal site installation.

I want to customize its text display as well as the "Add new content" link. How can I achieve this?


texts: How to add one more field in disqus form

texts: i have been installed disqus module in my drupal setup.it gives only one textarea field how to i add one more field to get subject from user.


texts: All HTML tags are automatically stripped from views block when placed inside a  element

texts:
I'm trying to use Views to create a custom block which will display the linked titles of all content of type "promotion" in a dropdown menu. Every result's title is displayed within an <option> tag whose value attribute is the URL of the result. The block is then displayed within a region called "promotion_menu" which is placed within an existing <select> element.

<select class="mobnav" onchange="location = this.options[this.selectedIndex].value;">
 <option value="/">Home</option>
 <optgroup label="About">
  <option value="/lessons">Lessons</option>
  <option value="/technology">Technology</option>
  <option value="/custom-fitting">Custom Fitting</option>
 </optgroup>
 <optgroup label="Learning">
  <option value="/category/1">Tips & Articles</option>
  <option value="/blog">Blog</option>
 </optgroup>
 <optgroup label="Enquire">
  <option value="/contact">Contact Us</option>
  <option value="/events">Corporate Events</option>
  <option value="/partners">Partners & Affilliates</option>
 </optgroup>
 <optgroup label="Events">
  <?php print render($page['promotion_menu']); ?>
 </optgroup>
</select>

The block itself works as expected when the region is placed outside the <select> element IE a series of option tags containing the relevant titles is displayed. However, when placed inside the element all the html tags are stripped and replaced with whitespace and the entire block is enclosed in quotation "" marks.

Is there a template doing this or is this just inherent behavior of the <select> tag which I have simply overlooked? I have tried it in its own <select> tag and have tried disabling AdBlocker to no avail.


texts:
In Drupal 8 reverting views to their original (in the core, custom or contributed module) became difficult. Supposedly the module config_update would allow reverting a view, but that promises to be a more laborious than simply clicking a link like we were used to in Drupal 7.

I was wondering if it would be possible to make selected views read-only? That way administrators with Views UI permission would have no edit link forcing them to work with a duplicate.

Hints on how to accomplish this? Any other possible workarounds?


texts: Steps to make a private file system working on a fresh install?

texts:
How can i make my media files stored as private and protected?
The users shoud only have access to that file if they click from the node file link, on nodes they can access to.

On a fresh install,the only destination option is public

/admin/structure/media/manage/file/fields/media.file.field_media_file/storage

EDIT :

i have now /admin/config/media/file-system

Chemin du système privé de fichier
C:\xampp\private

i have created a new file media with private storage destination

i have created on the basic page an entity ref field to that media and create a content

the direct file access is not blocked so i consider it is not working
http://localhost/drupal-8.6.7/system/files/2019-05/recherche-dev.pdf

the documentatiion mention on an apache server /docs/8/core/modules/file/overview

  When you specify the private directory in admin/config/media/file-system it will automatically create the sub-directory & create a simple .htaccess file with Deny from all. This stops Apache from serving files from this director

it does not work


texts: How do I create a custom theme, or layout using images?

texts: I would like to create a custom theme, for which I have the images for parts of the theme, such as header, footer, menu, logo. I don't understand how to start to create a layout. I have gone through "Themeing guide," but I don't know where to start.


texts:
is there a way in Drupal-7 to add form search in the content page filter
or add text box in the filter form for filter the nodes by node title
beside the type of node and publishing property


texts:
I have a block for a view that i'd like to display on a certain page, but BELOW that page's content. I have the specific page thing working fine, but no matter how many times I rearrange the block for the view to be above or below the "main page content" it does not seem to work! I have tried manually setting page weights in asc and desc order, as well as dragging it above and below. I'm saving often, flushing all caches, and generally grabbing at straws /-:

One hunch: the page it's displaying on is a page showing a custom content type... maybe because of that, "main content" (the only other thing in my "content" region) is not the right thing to order it wrt?

So I've tried already everything in How can i add a block below the content of a node? which is the same as the stuff on Add Block to Content but set it to appear after the node content?


texts:
I've tried the solutions here:

Display random value from multi-value field in Views

And here

views... two random nodes to vote on

This is what I have:
A content type (Inventory) involving a field collection of up to 10 items with a picture, price, description and a link.

I have a block view created filtered by category (so it shows up when users click on a particular category and a sort filter setup to randomize.

The block view shows field collection items.. but I only want it to show field collection items for one node at a time, then randomize the results.

Currently it's showing more than one nodes' field collection items..  When I refresh the page, it does randomize the results, but it's mixing nodes and field collection items together.  I just want to randomize the node.


texts: Best practice caching a variable between page loads

texts:
In Drupal 7...

In the case of a value that is only set through a module's settings page, and then remains unchanged until an administrator changes it (or the module is updated).

The value is checked each page load to perform a specific action. I'd prefer to prevent a DB read on each page load, for obvious reasons.

I can, of course, use variable_set and cache_get, but I was wondering...

A) Performance and behaviour wise, what is the actual difference between the two (both need database tables as far as I can see)?

B) Is there an equivalent to SESSION variable that this would be better in?

C) Would this be better off in a singleton class / global static value instead?


texts: Drupal 7: How do I translate the content of a checkbox I created?

texts:
I have a multilinugual site, content translation works. Now I added a content type and used the checkboxes/dario buttons field for a new field. How can I translate the content of such a field.

Let's say I put in gender male|Male female|Female now I have spanish and want the spanish text to be shown. How do I do that?

I found someone suggesting I had to use php fields, but I don't even see a php field there, although the module works in other places, besides even though I am a programmer this seems pretty complicated for the task.


texts: What Twig variable can i use to view Page Title or Taxonomy Name for a Taxonomy Type page

texts:
In Drupal 8 I need a way to get the Current pages title or Taxonomy name/ID.

In the template taxonomy-term.html.twig the variable works:

{{ term.id }}

I need the variable to work in page.html.twig

the following variables work only if the current page type is a node and not a taxonomy:

{{ head_title_array.title }} and {{node.field.category.entity.tid.value}}

I need to access this variable in the page template in order to use it as a class for a region based on what taxonomy page type is being displayed.

EDIT:

prints out page__taxonomy__term__# or null if not a taxonomy page:

{{ theme_hook_suggestions }}

prints out the title of the current page regardless of type:

{{ page['#title'] }}


texts: Create a node when the user is activated

texts:
Drupal Version: 8.92
Part 1. I am trying to create a node when the user is activated by the administrator for the first time. However, I am not able to find the right event/hook to execute the code. I tried "user_activated" but it is not working.
function my_module_user_activated(\Drupal\user\UserInterface $user) {
  \Drupal\node\Entity\Node::create([
    'type' => 'my_node',
    'title' => $user->getDisplayName(),
    'uid' => $user->id(),
  ])->save();
}

Any pointers?
PS: I don't want to create the node using hook_user_insert().
Part 2. If I need to delay the node creation to user validating the email by clicking a URL, what hook should I try?
Thank You!
Uri


texts: How to add new items to existing menu using custom module

texts: Is there any way to add new items to an existing menu using custom module in Drupal7.


texts: How do I update the configuration of a module?

texts:
I'm building a custom module in Drupal 8. It includes some YAML config files.
As I develop I need to change and add to the config, e.g. to add another field onto my custom entity.
At present the only way I've found to get Drupal to notice the changes is to uninstall the module and re-install it.
Is there a way to get Drupal to check that the config files provided by modules is the same as the active config, and if not, update the active config? How are module updates handled? In D7 hook_update_N would be used to add fields using PHP, but it looks like this should be handled by the CM in D8?
Things I've tried after updating the yml files in the module:

drush cr, config sync.

manually copying all the updated config files into sites/default/files/config_XXX/staging/ - but this gives this error "The staged configuration cannot be imported, because it originates from a different site than this site. You can only synchronize configuration between cloned instances of this site.".

manually importing the files one by one using the config manager. This works, but obviously there must be a more automatic way.

[EDIT] manually use the config_update module to inspect changes and 'revert' to the module's config. Again, this is manual.

EDIT: From Managing configuration - do's and don'ts

DON'TS
Try to change the active configuration on your site by changing files in a module's config/install directory. This will NOT work because Drupal will only read from that directory when the module is installed.

...but changes there are going to happen, unless modules are bound to whatever config they needed in their first ever release, and may never ever update or add config.
Thanks in advance.


texts: What is replacement of SSL/HTTPS in drupal to encrypt login credentials

texts:
I have one question, in my website i am not using ssl so my drupal login send id and password as plain text, then i have used the encrypt_sumissions module but that is use jcryption library but this is not useful, I want to know how can i encrypt login credentials without ssl/https.

Should I change in drupal core, I am new to this please provide me detailed information.
Thanks


texts: Cannot get articles or custom content types to load on front page

texts:
I am new to drupal. I have Drupal ver 8.5 installed on my local MAMP.

Unfortunately, though I am following a tutorial that is using version 7.28 (perhaps this is the issue). I cannot get my recently made articles OR custom content types to show on my front page.

a.) I have ensured that my URL under Front page > "Basic Site Settings" is blank.
b.) I have ensured that all my articles have "Promoted to front page" checked under the Promotion Options Tab.
c.) I have ensured that all my custom content types have "Promoted to front page" under the Promotion Options Tab.

What am I doing wrong?


texts:
I would like to setup a Drupal site with my existing GoDaddy Hosting Plan.

Do you recommend using the Drupal Application (provided by GoDaddy) or installing Drupal (core) manually into the hosting account?  Why?


texts: Auto-filling a form field with the sender page title

texts:
Basically, the user clicks on a "Book" button, which is in a "Trip" node; the user then is redirected to a booking form (Webform) where he will fill in basic info for the reservation. I need to auto-fill a field in the form with the title of the node from where the user was redirected.

I tried to use the Rules module and I successfully made the redirection process, but I'm stuck on how to prepopulate the field with the title of the sender page.

I've never developed a custom module, I'm new to Drupal but I have programming experience, so if there is a straight way to accomplish this (contrib modules) that would be great. Alternatively, I'm not afraid of digging into code.


texts: Export/Import Content Types/Contents to another Drupal site (version 6)

texts:
I'm looking for something to help me to export my content types / contents i have locally in a drupal project. i need to use it in another Drupal project.

I just stumbled upon the Bundle copy module but it is only available for Drupal 7 and my project is version 6.26 - I can't update my core unfortunately for various reasons.

is there something similar working for version 6 please?
Thanks in advance


texts:
Is there any way to get a list of some of many content types?

I am not asking to list nodes of content type(s).


texts: How to customize the url of a field in views?

texts:
I have a view that displays product images using a jcarousel. In the view, I have a jCarousel format and it displays fields. In the Fields section, I'm displaying Content: Image. I want to link the image to a specific url. I can modify it using Rewrite Results and selecting Output this field as a link.

According to the answer I got from how to make a field in a view be the link destination to another field? & http://64sqft.danapellerin.com/2011/06/07/drupal-custom-cck-field-tokens-in-views. Views takes into consideration the order in which your fields are in the view. The taxonomy field that you want to use as a token needs to be reordered above the field you want to use the token in the url.

Things I've tried:

I tried content:category (which is my taxonomy field), and hid it so it wouldn't display. In the field's replacement patterns it gave me [taxonomy_catalog] & [taxonomy_catalog-tid]. I tried [taxonomy_catalog] but the replacement gave me the text from taxonomy description.
I tried Content: All taxonomy terms, but it gave me the name of the term instead of the ID.

How can I modify the rewrite to include the taxonomy term id associated with the node?


texts:
Thank you in advance for reading my question.

Seems like many people have asked a similar question to what I'm about to ask, but mine has a subtle difference that I can't resolve.

I need to the ability to play a self-hosted video in a block on my Drupal 7 site. Per many people's recommendation, I downloaded/installed the Video module. That would work - if it was the only thing I'm displaying in the block. But there will be HTML content above and below the video, something I can't seem to produce with the Video module.

My preference is to self-host the video, not put it on YouTube or anything like that.

I hope my scenario/question makes sense. Does anyone have any suggestions for me?

Thank you very much!


texts: How to change taxonomy term in field with Rules?

texts:
I have a field status that when user uploads a file, is populated by a taxonomy term "uploaded". Now when an administrator downloads the file I need the status field up change to taxonomy term processing. I have tried using Rules but can't get it right.

The Rule is like so:

Event->content type viewed
Condition->User has Role of Administrator
and I can't set the action.

The action data is [node:field-status], Value [node:field-status:parent:1]
But when I test it, it changes the status to "none".
The taxonomy terms in order are: uploaded, processing, admin hold, error, closed. So shouldn't the parent:1 be processing?

Am I asking to much of Drupal 7.50, or can someone point me in the right direction?


texts:
I am trying to get some entities using the "entity.query" service.

What am I doing:

in my module (file "mymodule.module") I execute:

function mymodule_preprocess_page(&$variables) {
  $query = \Drupal::entityQuery('node');
  $query->condition('type', 'article');
  $nids = $query->execute();
}

What I get:

when I browse a page under the name of an authorized user - the request returns the results

when I browse the site as a guest, the query does not return any results.

Why am I not getting any results when I browse the site as a guest? Any ideas?


texts: Database problem after moving the site: unknown server error

texts:
I just moved my site onto the server and put it under /drupal_test directory. I now have got an error in the browser, but there is no errors in the apache error log:

PDOException: SQLSTATE[HY000] [2005] Unknown MySQL server host 'http://www.mydomain.com' (1)
in lock_may_be_available() (line 167 of /var/www/drupal_test/includes/lock.inc).

I have searched around online, many suggests that this is a problem with settings.php, but I can't see any problem with my settings:

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'websitedb',
      'username' => 'websitedbusername',
      'password' => 'thepassword',
      'host' => 'http://www.mydomain.com',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

I tried to use the ip address as the host, I got an error like this:

PDOException: SQLSTATE[HY000] [2013] Lost connection to MySQL server at
'reading initial communication packet', system error: 111 in lock_may_be_available()
(line 167 of /var/www/drupal_test/includes/lock.inc).

Also, my current site www.mydomain.com works fine.

Any help will be very much appreciated! Thanks!


texts: dev site reverts to production site url when clearing cache

texts:
I have moved a copy of my production site to a development box. When I clear cache at admin/settings/performance or save settings on a theme, all of a sudden the URL jumps from localhost/example/admin/build/themes/settings/theme to www.example.com/admin/build/themes/settings/theme for instance. I have cleared all of my cache tables manually via phpmyadmin and for the browser (chrome, cleared everything "from the beginning of time"). I can't successfully run cron .

EDIT: If I had enough reputation, I would downvote myself. I had the "base url" setting enabled in settings.php.


texts: Importing content to a content type with images and associated data

texts:
I'm trying to import images with ALT text and tooltip text into Drupal for a content type.

I'm using Feeds and Feeds Tamper to import the rest of my content right now, like so:
http://learningwithsage.com/wp/?p=212

And here's a technique for importing just the images:
https://www.drupal.org/node/1851322

But I'm still unsure how to do the tooltips and ALT Fields for the images.

Anyone?


texts: header and menu is missing from Login module page--user--login.tpl.php

texts:
I am implementing Custom Login module but Header is missing...

My Directory is :

modules
  |
  --- module_name
          |
          --- css
          |
          --- module_name.info
          |
          --- module_name.module
          |
          --- templates

module_name.module contains :

function module_name_form_alter(&$form, &$form_state, $form_id) {
    if ($form_id == 'user_login') {
        $form['name']['#attributes']['autofocus'] = 'autofocus';
        $form['name']['#attributes']['placeholder'] = t('Email');
        $form['pass']['#attributes']['placeholder'] = t('Password');
        // We don't really need descriptions to tell us what we already know...
        unset($form['name']['#description']);
        unset($form['pass']['#description']);

        // $form['#attached']['css'][] = drupal_get_path('module', 'module_name') . '/css/login.css';
    }

    // We don't want to change page titles on other pages.
    // Array of arg(1) url values on target pages.
    $pages = array('login', 'password');
    if (!in_array(arg(1), $pages)) {
        return;
    }

    switch ($form_id) {
        case 'user_login':
            drupal_set_title(t('Login'));
            break;

        case 'user_pass':
            drupal_set_title(t('Forgot your password?'));
            break;
    }
}

/**
 * Implements hook_theme_registry_alter().
 */
function module_name_theme_registry_alter(&$theme_registry) {
    $mod_path = drupal_get_path('module', 'module_name');

    $theme_registry_copy = $theme_registry;
    _theme_process_registry($theme_registry_copy, 'phptemplate', 'theme_engine', '', $mod_path);
    $theme_registry += array_diff_key($theme_registry_copy, $theme_registry);

    $hooks = array('page');
    foreach ($hooks as $h) {
        if (!isset($theme_registry[$h]['theme paths'])) {
            $theme_registry[$h]['theme paths'] = array();
        }

        _module_name_insert_after_first_element($theme_registry[$h]['theme paths'], $mod_path);
    }
}

/**
 * Function responsible for inserting a new element after the first one.
 */
function _module_name_insert_after_first_element(&$a, $element) {
    if (is_array($a)) {
        $first_element = array_shift($a);
        if ($first_element) {
            array_unshift($a, $first_element, $element);
        }
        else {
            array_unshift($a, $element);
        }
    }
}

templates/page--user--login.tpl.php contains:

<?php print $title; ?>

    <?php print $messages; ?>
<?php print render($page['content']); ?>

Everything is ok, but Header and Menu is missing (as defined in my current theme) from HTML output (/user/login), any suggestion?


texts:
I need to import a large amount of contents of a CSV file.
The file is a bit complex and still have a folder with a lot of images that are associated with each line of the csv.

As the file is complex and there are images to the mix, the existing import modules do not serve me. I'll have to create a script to perform the task.
My problem is that I am amateur in drupal (but experienced in php programming).

Do I create and run a cron in Drupal?
How do I programmatically create content?
How do I programmatically associate images to the content?


texts: How to get defined display names (id) from selected view?

texts:
Getting selected view is simple:

  views_get_view('name');

I didn't find and have no idea what do next...

I need to get every defined view page path and add menu item to it.


texts: Automatically Fill a Second Term Reference Field in a Node Based On Filled Value from a First Term Reference Field

texts:
Given the following...

A vocabulary (let's call Vocab1) with terms that each have an added term reference field referencing a single term from another vocabulary (let's call Vocab2).
A node that has two term reference fields, the first for a single term from Vocab1 and the second for a single term from Vocab2

would it possible to automatically fill the second term reference field from Vocab2 based on what's is filled in the first term reference field containing a term from Vocab1?


texts: Overriding a View table layout in module

texts:
I'm trying to override a view table from within my module. I can't locate what the arguments are suppose to be and in what order (for my hook_theme func). I copied the theme file from views/themes and did no modifications. Does anyone know what is going wrong, and what should the arguments value be below?

My theme configuration is currently:

'views_view_table__opportunities_mentions' => array(
  'arguments' => array(
    'view' => NULL,
    'title' => NULL,
    'header' => NULL,
    'fields' => null,
    'class' => null,
    'row_classes' => null,
    'rows' => null
  ),
  'template' => 'views-view-table--opportunities-mentions',
  'original hook' => 'views_view_table',
  'path' => drupal_get_path('module', 'smd') . '/theme',
),


texts: How can I ensure I retain access to a Drupal site after handing it over to a client?

texts:
Does Drupal have a mechanism which will allow me to keep control over a site after handing it over to a client?

If things go wrong with the client relationship, I need to be sure I still have control over the website.


texts: How to deal with someone trying to login as admin?

texts:
During these last days, I noticed in my dblog, that someone has been trying to sneak around.

The person tried finding the login url (my website isn't open for user registration) so they tried everything from my-domain.com/admin, my-domain.com/administrator.. and also my-domain.com/wp-login (which indicates that the person isn't familiar with drupal..)

Once the person ended up on /user he or she tried to login as admin by trying different usernames : admin, administrator etc... (I never use 'admin' as a username for the root user)

is there a way to prevent/protect a drupal website from this sort of things ?

Thanks

ps : i'm interested in how to do this both for d6 and d7.


texts:
I am working on porting a module from Drupal 7 to Drupal 8.
In the process I have to port a ctools content type plugin to the new context aware plugin.
The legacy plugin had "node" as a required context because it had to appear only on the node pages. I am finding it hard to implement it in the new plugin system.
Here is how I define the new plugin

/**
 * Provides a 'Custom' block for the current node.
 *
 * @Block(
 *   id = "machine_name_of_block",
 *   admin_label = @Translation("Admin label for the block"),
 *   context = {
 *     "node" = @ContextDefinition("entity:node", required = FALSE)
 *   }
 * )
 */
class ModuleBlock extends BlockBase {
  /**
   * {@inheritdoc}
   */
  protected function blockAccess(AccountInterface $account) {
    /** @var $user \Drupal\user\UserInterface */
    // $user = $this->getContextValue('user');
    $node = $this->getContextValue("node");
    if (!is_null($node)) {
      return AccessResult::allowed();
    }
    else {
      return AccessResult::forbidden();
    }
  }

  /**
   * {@inheritdoc}
   */
  public function build() {
    // Sample output which will be changed later.
    return array('#markup' => '' . $this->t('Powered by Drupal', array('@poweredby' => 'https://www.drupal.org')) . '');
  }

}

I have a problem in accessing the context value in this plugin using $this->getContextValue('node');. It seems to return null even if I am on a node page.
Am I missing something?


texts: How to set relationship when I create a new (custom) content to another (custom) content in Drupal

texts:
Premise: I'm new in the world of Drupal, so sorry if this is a stupid question.

What I need is to set some relationships for some new content types I created. For example, I created the "Person" content type and the "Group" content type. Using the "Relation" module I have defined the relation "is in", but now if I want to add a field for setting the relation at creation time, there are no edit widget available. The only way I found to set relationships is using the entity collector: too complicated for a user.

Example: a user creates the Person "John", and he want for him to set the relation "is in" with the Group "Drupal fans". So, during the creation of this Person he needs, for example, a select control that lets him to choose from all the groups already registered in the site.

In brief, I need to manage some entities created by me, with CRUD controls, list, etc. and I need to set some relationships from these entities.

What is the best method/ what are the best module/ how I can do this?


texts: I'm in the process of writing a custom views filter handler. In order to learn from the existing filters, I'd like to know how I can tell which filter class views is using when I'm configuring an (exposed) filter on the GUI.


texts: Custom module to alter display value of field

texts:
I have a question about custom modules. I am trying to write a module that changes the display value of a field. I think the thing I'm trying to do require a

hook_page_alter

method, and to change the field

$page['content']['system_main']['nodes'][$nid]['body']

So far I'm haven't been able to change anything on the page. Would anyone have a good solution?


texts:
I am having a bit of trouble figuring out a thing with Drupal Calendar.

I have created a custom content type , with a date field.
I display the dates as events in a Calendar style view.

I want to add custom "event" on the day(s) after this event,based on some PHP logic.
What would be a starting place to start modfitying it  ?

For example: I insert 26th of May as a date (in a node of my custom content type).
If the day is Saturday, I want the next day to be also marked in the calendar.


texts: Add bootstrap css class 'list-group' to Drupal facet class js-facets-checkbox-links

texts:
I want to theme the Drupal facets into the Bootstrap theme.

1) How do I add a bootstrap css-class list-group to the existing facet class js-facets-checkbox-links. So I get:

2) And how do I replace an existing facet class facet-item with list-group-item:


texts:
I'm using the one page site module to make a one page design website. When scroll down, I want the menu to mode up to the top of the screen and get sticky there. I found some solutions for that, e.g. here.

The problem is that when I include jquery library link to my page.tpl.php to make the sticky menu script work, the one page site module doesn't work anymore. This module depends on the jquery update module. How can I combine the one page site module with a jquery sticky menu?

Thanks!
Steven


texts: Is there any condition based field security in Drupal? E.g. An administrator can only edit user details users who are from the same Country?


texts: How to create a Content Type field that will be only set by query parameters?

texts:
I'm using Drupal 7. I want to create an Entity Reference field in my Order content type that will be set based on whatever the query parameter node ID is for my parent node. In other words, the user is viewing a table list of parent nodes. The right-most column is a link to "File Order" (as in, create a child node relating to that particular parent node). So the URL that it links to is /node/add/order?nid=[nid of parent].

On the Order node add screen, the "Related Node ID" Entity Reference field should auto-populate based on whatever the nid query parameter is. So the user should not have to worry at all about setting that value ever. How do I do this?


texts:
Is it possible to create RDF mappings for a single node in Drupal 8?

I've enabled the module RDF and also downloaded and enabled RDF UI and its submodule - RDFUI_builder.

I've already created RDF mappings for some content types but when I edit a single node there is no option to edit its fields.


texts: Create new child field collection programmatically

texts:
I have 2 field collections (Parent and child)

Parent Field collection: Test Student Info
machine name: field_test_student_info
Child Field collection: Marks
machine name: field_marks

In parent field collection have 1 field:

Field1: Student Name
machine name: field_student_name

In child field collection have 2 fields:

Field1: English Marks
machine name: field_eng_marks
Field2: History Marks
Machine name: field_history_marks

I have set field setting "unlimited" to child field collection (Marks). I just want to add new child field collection item programmatically.
I have tried below code but it's showing me error:

use Drupal\Core\Field\FieldItemListInterface;
use Drupal\field_collection\Entity\FieldCollectionItem;

function CreateChildFC() {
  $node = \Drupal\node\Entity\Node::load(770);
  $load = FieldCollectionItem::load(207); // Loading child FC from parent FC i.e Marks
  $field_collection_items = $load->field_marks;
  $field_collection_item = FieldCollectionItem::create(
   [
    'field_name' => 'field_marks',
   ]
   );
  $field_collection_item->setHostEntity($node);
  $field_collection_item->set('field_eng_marks', '89');
  $field_collection_item->set('field_history_marks', '75');
  $load->field_marks[] = ['field_collection_item' =>   $field_collection_item];
  $node->save();
}

Error
The website encountered an unexpected error. Please try again later.
TypeError: Argument 1 passed to _field_collection_field_item_list_full() must implement interface Drupal\Core\Field\FieldItemListInterface, null given, called in /site/modules/contrib/field_collection/src/Entity/FieldCollectionItem.php on line 333 in _field_collection_field_item_list_full() (line 151 of modules/contrib/field_collection/field_collection.module).


texts: How can I display a block on view page, excluding paginated/paged/pager output pages?

texts:
I'm trying to use Context to display a block on a view page path, e.g. /view, but exclude it from the paged output, e.g. /view?page=1. The path exclusion tools in Drupal 8 don't work with the query string (and no query string rules are available).

There's a Drupal 7 solution (hack?) for this posted on How can I show a block in a view page, excluding its paginated pages?

Any help to get something like this in Drupal 8 working would be appreciated.

The issue on Drupal.org is https://www.drupal.org/project/context/issues/2930896.


texts: How can I do an OR operation on the values of facet search? (without Solr)

texts:
I'm using the Search API with Facet Search to filter my nodes in a view. How can I do a OR operation here? Can't find this setting.

Ex. If I have a facet filter of colors and I select the colors yellow and green, I will only see the products with yellow AND green. I want to show all the products with the yellow tag OR green tag.


texts: How to unzip or uncompress a file .epub on Drupal?

texts:
I've created a content type that upload files .epub on database. Now for some reason (to use epub on a mobile app) I need to get the file .epub uncompressed.

It's like in my content type I upload a .zip file but when drupal store it it's stored unzipped.

Did someone knows a Drupal API function or a method that uncompress or unzip a .epub files?

Note that when I upload an .epub file or .jpg image or any other type of extensions, in the table file_managed I always get filemime : "application/octet-stream"? is it normal ?


texts: How do I remove an option from a select list if it's already been used in a submission in the past?

texts:
We're trying to create a select list as a part of a webform but we want to remove an option from the select list if it has already been chosen.
An example of this list is for Chart of Accounts against Projects where a Project can only be a part of a single Chart of Account.
In Drupal 7 possibly we could do this with the webform validation module and setting a field to be unique.
I'm not sure how to achieve this on Drupal 8.


texts:
My site is on localhost and I have access to database too. This is the structure of "users" table:

The password field is of type "varchar(32)" having collection "utf8_general_ci". I tried to decrypt the password online but it displays that password can't decrypted.

I manually updated the table and changed the password using md5 but whenever I try to login to the site as admin, it displays "Access Denied".

How to change the password for site?


texts: How To Alter Web Form Elements Permanently?

texts:
Webform elements can be altered using the function MYMODULE_form_alter. However the changes are not permanent. For example, if you're changing the title of an element from '#title' => t('Old Title') to '#title' => t('New Title') ,the change will not affect source - the (View) Source page will still show '#title' => t('Old Title')
So my question is: Is it possible to alter the source (YAML) from code because that will make changes permanent.I have tried to locate weformX.yml for webformX inorder to alter it in code but I can not find.


texts:
On my "teaser" view mode I want to display my Image field but if the Image field is empty I want to display my Title field instead.

I have tried using hook_preprocess_node but it appears that this is not called when rendering the node in the "teaser" display mode when using Display Suite.

Another thought I had was to create a custom DsField plugin... but in that case I do not have the context of the other fields (unless I do?) so I cannot say "if img is empty display title, else display img" Using the suggestion below I came up with:

class ImageElseTitle extends DsFieldBase {

  public function build() {
    /** @var /Drupal/node/Entity/node $node */
    $node = $this->entity();

    if ($node->get('field_event_image')->isEmpty()) {
      return $node->get('title')->view('teaser');
    }
    else {
      return $node->get('field_event_image')->view('teaser');
    }
  }

}

But in this case the settings for the title field are not obeyed. For example, it is wrapped in a span instead of an h2 as specified in the display settings. Similarly it is not a link even though "link" is checked in the display settings...

I tried adding a preprocess to the title field that checks if the image field is empty, but I think the preprocess function is too late to say "the image field is not empty, so never mind, dont display the title"

Thoughts?

-- Continued --

I also tried this, but the fields are not hidden as I'd expect them to be:

function mymodule_ds_pre_render_alter(&$layout_render_array, $context, &$vars) {
  if ($context['entity_type'] == 'node' && $context['bundle'] == 'event' && $context['view_mode'] == 'teaser') {
    if ($context['entity']->get('field_event_image')->isEmpty()) {
      $layout_render_array['field_event_image']['#access'] == FALSE;
    }
    else {
      $layout_render_array['node_title']['#access'] = FALSE;
      $layout_render_array['title']['#access'] = FALSE;
    }
  }
}


texts: How do you go about using contexts and a menu page callback?

texts:
Currently we have a page that is generated by a hook menu page callback. The path is structured like menu/%location_name/menu/%parent_category/%child_category. The function requires at least one of the category wildcards to properly work.

In the page callback we then set up our context's condition which is to determine which of the categories we're in. See code below:

  if(empty($term_parent) == FALSE || empty($term_parent) == FALSE) {
    if ($plugin = context_get_plugin('condition', 'ss_menu_core_condition_default')) {
      if(empty($term_parent) == FALSE && empty($term_child) == TRUE) {
        $context_term = $term_parent->tid;
      } elseif(empty($term_parent) == FALSE && empty($term_child) == FALSE) {
        $context_term = $term_child->tid;
      }
      $plugin->execute($context_term);
    }
  }

Everything up until this point makes a bit of sense to me. And currently it validates fine and I can actually see the context when using context_active_contexts(). Although the gotcha that I must be missing is how do i go about allowing the metatags context module's reaction to use this term for token replacement?

At first the tokens avaliable were pretty generic default site wide things such as current page, current user, date, etc... It wasn't until i found a patch that taxonomy terms ended up showing up as token replacements. But none of them seemed to work as it seemed the context didn't know of what term to use.

This leaves me at a point where I felt like the only solution was to do something hackish and just set my values in the active context as follows:

  $context = context_active_contexts();
  $context['ss_menu_core_menu_sections']->reactions['metatag_context_reaction']['metatags']['und']['description']['value'] = $context_term->description;

This still doesn't feel right at this point since we can't actually use the metatags reaction form to populate the values. If anyone has any ideas that would be amazing.

Thanks.


texts:
My goal is to create a custom field, with a combination of properties -- Heading, Body, Image -- to produce, for instance, a hero component. The image, in my case, would be optional.
I can't use paragraphs, since it needs to be a field on the node but also a block to be displayed outside of its layout. See image below...

I've accomplished everything so far, thanks to this article as a springboard, with a single (important) exception:
https://github.com/WiddleWabbit/Drupal-ExtendedImage/blob/main/src/Plugin/Field/FieldType/ExtendedImageField.php
If an image isn't uploaded at the time of node save, the supplemental fields (heading, body) don't save and there is no database entry.
I'm not sure how to make the image, itself, optional and still save the other fields.
Here is where I'm at:
https://github.com/DrupalPhil/ExtendImageItem/blob/master/Field/FieldType/HeroItem.php


texts: Set body format for a node when it is updated via REST API

texts:
I noticed that when I PATCH a node and update the body value, the body format and summary are set to null.

If I try to add the summary and format to the json sent to the API, I receive an error saying:

Unprocessable Entity: validation failed.
Body: this field cannot hold more than 1 values

Any ideas why I get this error and how can I preserve the body format?

This is my js object:

{
  title: { value: this.state.title },
  body: { value: this.state.body, format: "basic_html" },
  type: { target_id: 'article' },
  _links: {
    type: {
      href: 'http://localsite.dev/rest/type/node/article'
    }
  },
}

If I remove the format: "basic_html" part, I get no errors but the format and summary are set to null.

Thanks.


texts: Generate classname from variable in template

texts:
In the template file for a view with grouped rows, I would like to add the group title as class name, but the rendered class name from the title variable is just _ on every group. This is the generated HTML markup for the group whose title is 1.

1

What's wrong here?
This is the template file content.
{#
/**
* @file
* Default theme implementation to display a view of unformatted rows.
*
* Available variables:
* - title: The title of this group of rows. May be empty.
* - rows: A list of the view's row items.
*   - attributes: The row's HTML attributes.
*   - content: The row's content.
* - view: The view object.
* - default_row_class: A flag indicating whether default classes should be
*   used on rows.
*
* @see template_preprocess_views_view_unformatted()
*
* @ingroup themeable
*/
#}
{% if title %}
  {%
    set classes = [
      'views-group',
      'group-' ~ title|clean_class,
    ]
  %}

{{ title }}

{% endif %}
{% for row in rows %}
  {%
    set row_classes = [
      default_row_class ? 'views-row',
    ]
  %}

    {{- row.content -}}

{% endfor %}


texts:
I have to perform actions on about 15000 users.
I'm using a query to retrieve all uids, but the script crashes when using the user_load_multiple

$uids = db_select('users', 'u')
          ->fields('u', array('uid'))
          ->condition('u.status', '1', '=')
          ->execute()
          ->fetchCol();

$users = user_load_multiple($uids);

The script is executed every night, in order to find all users for which the field "Contact again on" (field_contact_on) is empty. If it is empty, we put todays date + 1 year.

Does anyone has a suggestion on how to make this more efficient.

Thanks !


texts: Node field autopopulate based on taxnomy term value

texts:
I have a Vocabulary called Cars. Each term has two fields (name [default drupal field] and status, Example: [name] Mercedes E220 - [status] Available)
In my node/content type I want to create two fields (Entity references). They reference the two fields (name+status).
The behavior should be when you type in the 1rst field Name (which references the name field) you should be able to search for any/all terms from the Cars vocab [this is a standard autocomplete field which I already built], and when you select Mercedes E220 the field bellow which is the Status is auto-populated with the value of the Status field from the taxonomy term.
Any ideas on this?


texts: What is the best way to generate node(book) to ePub?

texts:
I want to create a Journal site that can generate book(node) to ePub, like Open Journal Systems(OJS). So what is the best way to generate node to ePub? I have tried Printer, but it only show the following error messages on iBook. File generated by PHPePub(Printer) can open by Calibre, but all images are missing.

  This page contains the following errors:

  error on line 47 at column 27: AttValue: " or ' expected
  Below is a rendering of the page up to the first error.


texts: Include a user registration form within another form

texts:
I am trying to include a user registration form within a Commerce pane form.  I am currently using (within buildPaneForm):

$user_form = $this->entityFormBuilder->getForm(user_load_by_mail($this->currentUser->getEmail()), 'guest_checkout_profile');
$pane_form['user_form'] = $user_form;
$pane_form['user_form']['#tree'] = TRUE;

The user form simply isn't shown though.  I can add a test field that will show:

$pane_form['test'] = ['#type' => 'textfield', '#title' => 'test'];

$user_form has the correct form array, with the appropriate fields from the guest_checkout_profile form display mode.

I was pointed to IPE's embedding a form within another form, but I don't see how what I'm doing is different there (from a "get the form to show" standpoint - validation and submission I'll deal with if I get there :D).

Baby steps - how can I get the form to even be rendered?


texts: Reverting blocks and other pseudo-exportables in an install hook

texts:
We have a medium-sized Drupal 7 site whose configuration is almost entirely stored in code, in a single Features module.  In order to permit automated testing and a cleaner development workflow, I'd like to make it possible to install a new instance of the site from scratch without cloning the database.  To that end, I've created a simple install profile (based on the standard profile) which enables our themes and configuration module.  This mostly seems to work, but I've found that some feature components are not immediately reverted on the newly-installed site: specifically, blocks exported with fe_block_settings, user permissions, and variables.  All these are applied if I run drush fra -y from the command line after installing the new site, but I would like to do everything programmatically to make writing tests easier.

There is some discussion of the problem with blocks at https://www.drupal.org/node/1901116, but I've tried the fix given there (calling module_install in the hook_install implementation instead of listing a dependency in the .info file), without successs so far.  That page also doesn't address the issues I'm seeing with variables and user permissions.

Is it possible to successfully apply all of these exported feature components from an install hook, or do I need some other mechanism?


texts: How do you check to see what your drupal site looks like as different types of users?

texts:
I hope to find a way to stay logged in as admin but see what it looks like to an unauthenticated user and other types of users too, if possible.

I ask firstly because right now I am trying to make certain changes to the css file which means I need to check what the change looks like to an unauthenticated user. Sometimes it is easy to see more or less what I want in the admin pages but I do find I can get tripped up by this sometimes and also find I need to clean the cache of my browser before I can actually see how it looks. This is something that I do not really want to be taking much time over as I want to be able to correct it quickly if I made something look terrible.

Aside from that I do also have a few different kinds of users with various permission rights and when I change something I want to check that a change is doing what I want and all the users are still seeing the right things. Again, it is not an ideal situation for me to have to log out and in as each type of user for this type of thing as it can expose parts of the site if a mistake has been made or there is some bug rearing its head etc.

Aside from the aforementioned issues I have with needing to log in and out after every little change I make to the site, it makes the whole process pretty laborious. It suddenly dawned on me that someone else might have thought this too and that there is some way to work around it without compromising anything. Can anyone advise on this?


texts:
I want to change the value of a field for a node.I used the following code:

$node = node_load($nid); // $nid is the function's parameter
$node->field['field_myfield'][$node->language][0]['value'] = 1;
node_save($node);

The problem is $node->language returns es while in print_r($node) it's und.
Why $node->language is different from what's in $node array and how can I get it?


texts: Get term name for page title from term id passed in the contextual filter?

texts:
What is the correct method of getting term name in the page title field if I have passed the term id in contextual filter.
I have added the Content: Has taxonomy term ID contextual filter in views, I have tried to overwrite the page title be provide "%1" but that also provides term id as the "filter value type" contains term ID.

One way to achieve this using the "global php" field in the header and getting the term ID from the argument as "arg(1)", and getting the term name from the term ID and than setting page title using "drupal_set_title($term_name)".


texts: Drush bootstraps fine via root, but fails via regular account (SSH, dedicated server)

texts:
I hope someone here can help me out on this one: After pushing our site live, I am now trying to get Drush running on our live server. I have gone for a manual install via our root account, got the library and dependencies inside the /usr/local/lib/drush, a symlink at /usr/bin/drush and made sure that execution rights are set for both root and the regular account.

on the regular account (a.k.a. not-root account), tasks like downloading a module work fine, it puts the module into the correct directory and everything, but commands that require a database connection fail with this notice:

[error] Command pm-enable needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.
[error] The drush command 'en metatags' could not be executed.
[error] Drush was not able to start (bootstrap) the Drupal database.
Hint: This may occur when Drush is trying to:
 * bootstrap a site that has not been installed or does not have a configured database. In this case you can select another site with a working database setup by specifying the URI to use with the --uri parameter on the command line. See `drush topic docs-aliases` for details.
 * connect the database through a socket. The socket file may be wrong or the php-cli may have no access to it in a jailed shell. See http://drupal.org/node/1428638 for details.

However, executing commands like pm-enable via the root account work perfectly fine!

Doing a drush -v status does not result in any errors, but (unlike via the root account) it does not yield in a successful database connection.

I attempted to run the mysql command manually with the same host/username/pass as set in the settings.php, and that worked perfectly fine.
I have tried forcing 127.0.0.1 as host as suggested by the link in the outputted notice, but obviously no luck, as the mysql socket seems to be fine.
Execution rights on mysql and php-cli are available and the php.ini file is readable from the main account.

Conclusion/Assumption:
Because the root account is having no issues but the regular account does, I assume the issue boils down to missing execution and/or reading rights. But – if that is the case – for which file?

The reason I don't want to handle our drupal installation from the root account is not only would that likely mess up file permissions and ownership (modules downloaded via root will be owned by root?), but also I would simply feel more comfortable working via an account that does not have the abilities to nuke the entire server.

Some further details on the setup:
- PHP OS: Linux
- Drush version: 7.0-dev
- Drupal version: 7.27
- PHP version: 5.5.11

I hope someone here can point me towards the right direction of solving this issue. Any form of help would be greatly appreciated!


texts: views entity reference to point email instead of uid in contextual filter?

texts:
I'm using Drupal 7 and Views. I've been trying to sort out, entity reference to enable a contextual filter to sort by email, instead of UID as currently I am doing.

Is that possible?


texts: How to find out allowed memory for a specific Drupal page

texts: I want to find out how much allowed memory a page uses after it is loaded on my drupal 6 site. I know that you can do this when a page is not loading correctly, by enabling errors in php.ini. How do find this out on successful page loads?


texts: Does a template override require a subtheme?

texts:
Feels like a silly question to ask, but I can't find a definitive answer anywhere.

Background

My project is a multi-site that features several themes that our users can choose from. These are all installed in /sites/all/themes. For one site in particular, I wanted to simply use a different page.tpl.php file. I tried copying the theme's page.tpl.php file into /sites/my_site/themes, but this didn't seem to work. This leads me to the question:

In order to override a template, must I use a sub-theme?


texts: Different Site name and slogan for Organic Groups based multisite architechture

texts: I am using OG based multisite in Drupal. I need to override sitename and slogan of default values so that each organic group has its own set of system values like Sitename and slogan etc.Also I am using Variable and OG Variable modules which seem to be for this purpose, but changing variable Realms in Organic groups variables doesn't save the values, the admin form for changing variable values doesnt save values. What am i missing?any help?


texts: Upgrade 8.4.8 to 8.5.11 error Inspector not found

texts:
I'm trying to upgrade from Drupal 8.4.8 to Drupal 8.5.11 but I'm stuck on the following error

    Drush command terminated abnormally due to an unrecoverable error.                                                                                [error]
Error: Uncaught Error: Class 'Drupal\Core\Plugin\Inspector' not found in docroot/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php:151

Here's the steps I ran:

1. composer remove drupal/console

2. composer require acquia/blt:8.9.15 acquia/lightning:~3.1.0 --no-update

3. Add the following code to the "conflict" section of composer.json file.
"drupal/core": ">=8.6.0"

4. composer update acquia/blt dmore/chrome-mink-driver acquia/lightning drupal/core cweagans/composer-patches "symfony/*" --with-all-dependencies

5. drush updb -y

The error show up when I ran the step number 5 (drush updb -y)


texts:
I want to add a wrapper around the panes which are shown in red box in the given image. How to achieve it.

I have already tried Panels Extra Styles module but it is not providing a wrapper around two or more panes.


texts: How to apply a patch file in composer to a submodule of a module?

texts:
I've added the patch to composer.json like this:

  "drupal/admin_toolbar_tools": {
    "Bring back media to dropdown menu": "https://www.drupal.org/files/issues/2019-01-16/admin_toolbar-media_link-3026216-3-option2-D8.patch"
  }

However, admin_toolbar_tools is a sub-module of admin_toolbar (admin_toolbar/admin_toolbar_tools).

I ran composer install, but it doesn't trigger the patch apply process.

The patch I am trying to apply is the following one (https://www.drupal.org/files/issues/2019-01-26/admin_toolbar-media-link-3026216-8-option3.patch).

diff --git a/admin_toolbar_tools/admin_toolbar_tools.module b/admin_toolbar_tools/admin_toolbar_tools.module
index 9ac389c..1f8a36b 100644
--- a/admin_toolbar_tools/admin_toolbar_tools.module
+++ b/admin_toolbar_tools/admin_toolbar_tools.module
@@ -621,20 +621,23 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {

   // If module Media enabled.
   if ($moduleHandler->moduleExists('media')) {
-    $links['admin_toolbar_tools.add_media'] = [
-      'title' => t('Add media'),
-      'provider' => 'admin_toolbar_tools',
-      'route_name' => 'entity.media.add_page',
-      'menu_name' => 'admin',
-      'parent' => 'system.admin_content',
-    ];
+    // Displays media link in toolbar.
+    if (in_array('entity.media.collection', $routes)) {
+      $links['admin_toolbar_tools.media_add_page'] = [
+        'title' => t('Add media'),
+        'provider' => 'admin_toolbar_tools',
+        'route_name' => 'entity.media.add_page',
+        'menu_name' => 'admin',
+        'parent' => 'system.admin_content',
+      ];
+    }
     // Add node links for each media type.
     foreach ($entityTypeManager->getStorage('media_type')->loadMultiple() as $type) {
       $links['media.add.' . $type->id()] = [
         'title' => t($type->label()),
         'provider' => 'admin_toolbar_tools',
         'route_name' => 'entity.media.add_form',
-        'parent' => 'admin_toolbar_tools.add_media',
+        'parent' => 'admin_toolbar_tools.media_add_page',
         'route_parameters' => ['media_type' => $type->id()],
       ];
     }


texts: Correct way to render fields from Entities?

texts:
This very popular article explains correct way to render fields:
http://www.computerminds.co.uk/articles/rendering-drupal-7-fields-right-way

According to the article, the correct way to render fields is like this:

$node = node_load($nid);
$field = field_get_items('node', $node, 'field_name');
$output = field_view_value('node', $node, 'field_name', $field[$delta]);

But this is for rendering fields that are stored in a node. How would you use the code for fields in an entity?

 More info

I am using Paragraphs module that lets you create custom bundles in the predefined "paragraph" entity.

You can use entity.tpl.php to override the output of Paragraph module fields.

I want to print my fields that are stored in the entity, but the above code won't work because it is for nodes.


texts: How to add addition settings in node edit page on rightside bar

texts:
I want to add additional settings in node edit page (node/*/edit) on right side bar. How can i achieve this drupal 8?

Update

To be more clear, I have installed url_redirect module and it is showing settings in node edit page in drupal 7. But in drupal 8 there is no such settings. So I want add those settings by myself, but on right side bar.


texts: Best way to delete all variables when uninstalling module

texts:
I'm writing a module that writes several variables (three, four variables for every content type, and other).

Which method should I use to delete them on hook_uninstall?

Is it safe to perform a query, searching "mymodule_*" variables?

Or should I loop for content types and search variabels, so call many times variable_del?


texts: Custom module interfering with CSS on /user page

texts:
I am having trouble with a custom module. When my site is working properly, the /user page loads 4 CSS files. After rebuilding the cache, only three files load. It's not a 404, Drupal doesn't even try to load the last file.

If I disable the module and load the /user page, the CSS loads properly. I can then re-enable the module and the /user page continues to work. Doing a cache rebuild breaks it again. I'm wondering how that CSS file is generated, and how I can make it load properly when my module is enabled.

Oddly, this issue occurs even if I remove all implementation details from the module: the xyz.services.yml file and the src folder. The only remaining files are README.md and the barebones xyz.info.yml file:

name: XYZ Customizations
description: XYZ-specific additions and modifications.
package: Custom
type: module
version: 1.0
core: 8.x

I'm very confused why this might be happening. Any insight would be appreciated. Thanks!


texts: How to serve images for retina displays? It seams that there is no modules for drupal 8 in stable release. How can we properly set up to serve hi-res for retina displays?


texts: While reading the Ajax framework documentation I came across mention of the #ajax property. I know from poking through the code that there are others of these properties with hash signs in front of them. What does the hash sign signify? What are these properties all about?


texts: Themes and module installation and update scripts give a server 500 error

texts:
In order to upgrade a drupal 6 website without shutting it down during the upgrade process, my provider prepared a new web space without a domain name. (The plan was to transfer the domain name as soon as the new site was ready)
I installed Drupal 8.02 nl (dutch version) using installatron without any problems. However, afterwards I noticed that it was impossible to upload and install themes and modules using the dedicated drupal scripts. The scripts started normally until I had to input my FTP login and password. After pressing "doorgaan" (continue) I receive the following message:

  The website cannot display the page

  HTTP 500

  Most likely causes:

  The website is under maintenance.
  The website has a programming error.

On the other hand it was possible to upload the theme and modules manually with a separate FTP program. At that time I didn't pay much attention because I thought that the reason was the missing domain name.

Meanwhile, the domain name has been transferred; the site is operational, but the problem still exists. I also get the same error message when I try to update the manually installed modules. I checked the permissions of the different files and directories, but couldn't find any anomalies

Meanwhile, the drupal version has been updated to 8.04 by installatron and the status report gives an error/warning that the database needs updating.

  Some modules have database schema updates to install. You should run the database update script immediately.

When I click on the database update link, I again get the error message the "page could not be found".

Could anyone help me out of these problems?


texts: Use form_alter to add placeholder text to a Views Exposed Filter min/max field

texts:
I have an exposed "List Price" field in a View using the "in between" operator (so that users can search for content between this price and that price), and I need to add the text "Min Price" and "Max Price" as placeholder text for the Min and Max fields. I had success using the custom module below to add placeholder text to other exposed fields using the "is equal to" operator, but I have had no luck using the same module code to affect the min/max fields. Here is my working module code:

<?php
function bootstrap_primary_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == "views_exposed_form") {
    if (isset($form['field_productname_value'])) {
            $form['field_productname_value']['#attributes'] = array('placeholder' => array(t('Product Name')));
    }
  }
 }
?>

and here is the code that does NOT work for the "min" portion of the price field:

<?php
function bootstrap_primary_form_alter(&$form, &$form_state, $form_id) {
  if($form_id == "views_exposed_form") {
    if (isset($form['field_listprice_value[min]'])) {
            $form['field_listprice_value[min]']['#attributes'] = array('placeholder' => array(t('Min Price')));
    }
  }
 }
?>

Can someone please guide me on what I am doing wrong and how I can make it work? Could it possibly me the "[min]" portion of the module code that is tripping things up?

In case it helps, here is the full code for the List Price field:

            List Price

  <input type="text" maxlength="128" size="30" value="" name="field_listprice_value[min]" id="edit-field-listprice-value-min" class="form-control form-text">

  And
 <input type="text" maxlength="128" size="30" value="" name="field_listprice_value[max]" id="edit-field-listprice-value-max" class="form-control form-text">

...and here is the full code for the field that the module worked on:

            Product Name

 <input type="text" maxlength="128" size="30" value="" name="field_productname_value" id="edit-field-productname-value" class="form-control form-text" placeholder="Product Name">

Thanks!


texts: How can I manually change image orientation?

texts:
I manage a website with Drupal 7 where users can upload pictures from their mobile or from their desktop. I have configured Image Style with "autorotate" effect and most of the pictures are well displayed after styling.

But some are misoriented and I'd like to be able to manually change the picture orientation (or let the user do it).

Do you know a solution for this ?


texts: How do I send an email when users update their email address?

texts:
If users update their email address, an email should be sent to the old and new email addresses to confirm the transaction.

How can I achieve this in Drupal 8?


texts:
I have a grade vocabulary with a 6. Class taxonomy term. The taxonomy page have an URL like
www.example.com/foo/6-class/bar and I can't find the taxonomy with the following code.

$grade = arg(2);
$term = taxonomy_get_term_by_name($grade)

It works when I use a string (e.g. 6. Class), but not with arg(2). How can I get the correct taxonomy with this URL alias? Problem might be, that it is a exposed filter and no contextual filter. But I can not change this fact.

Neither I can get the source path with the following code.

drupal_lookup_path('source', $_GET['q']);
drupal_lookup_path('alias', current_path());


texts:
I need to export blog entries from Drupal to a XML RSS feed or a CSV file. I have spent countless hours trying to export it, however, no results whatsoever. I have created a new view based on the defaults of the Blog node and have set the following parameters:

Style: RSS Feed
Row style: node
Items to display: 25
Path: latestblogs/feed
Attach to: Blog page

The feed page does work, however, none of the entries are appearing. What do you think is the issue?


texts: Change the bulk operations confirmation page

texts:
How to change confirmation page in bulk operations?

Currently it is printing "You selected the following 4 items:".

I want to list titles of all items included in the bulk operation.


texts: CSV Feeds import troubles with CiviCRM entity reference field

texts:
I'm stumped with this particular Feed import problem.

I've got a content type (node) that has an entity reference field that relates it to an number of CiviCRM organization contacts. When you manually create a node, the entity reference field auto-completes the field and if you look at it in the editing view, you see the name of the contact along with their CiviCRM unique contact id. It would look like the following:

Contact Name [cid:8]

In the regular view, you just see the Contact Name.

I figured I could use Drupal Feeds and Feeds Tamper and then create a CSV import but I can't seem to format the entity reference field correctly so that the data is accepted. I've tried setting it to "Organization Name" as well as "id" and "user_unique_id". I've fed it straight integers for id and the unique id and I've tried "Contact Name [cid:8]" as well as just the contact name or just the "[cid:8]" part and nothing seems to stick. The content is created but the entity reference field remains empty. I can of course manually enter the values but that defeats the point of the import.

Any ideas?

These are the pertinent parts of the site:

Drupal 7.x
CiviCRM 4.4.x
Feeds
Feeds Tamper
Entity
CiviCRM entities
Entity Reference
CiviCRM Contact Reference Field

Thanks,
Andrew


texts: How to remove "Time Zone" element "user_register_form" form using hook_form_alter

texts:
I analyzed the "Create new account" page of drupal by using hook_form_alter and $form variable. as you see, #form_id value is: "user_register_form" and other elements are as following:

attributes->Array
administer_users->Array
#attached->Array
#cache->Array
account->Array
language->Array
#entity_builders->Array
#process->Array
#parents->Array
user_picture->Array
actions->Array
#form_id->user_register_form
#type->form
#action->form_action_p_pvdeGsVG5zNF_XLGPTvYSKCf43t8qZYSwcfZl2uzM
#build_id->form-78GnGyO2iwZsooojZLCOiAw9pYXyDqngJ5C0DU_EzUQ
form_build_id->Array
form_id->Array
#id->user-register-form
#method->post
#theme_wrappers->Array
#defaults_loaded->1
#tree->
#validate->Array
#submit->Array
#theme->Array
contact->Array

I want to remove "Time Zone" element of this form (user_register_form), which of this array elements should I unset to remove that element?


texts:
I think this may have happened when upgrading to Drupal 8.5.x, but I can no longer edit a panel variant.

I can add a new variant and seem to be offered the typical layout, content, etc., but nothing happens when I click a variant, and I don't have the typical menu selections (see screen shot).

I am logged in as User 1 with all permissions checked. There are no errors in the error log. I have the latest dev version of all the relevant modules (Panels, Ctools, etc.).

Any guidance would be greatly appreciated.


texts:
I'm trying to create a custom form displayed inside of a block.
[edited]

 <?php

function edit_node_block_info(){
    $blocks['edit_node'] = array(
        'info' => t('Custom Block to allow edit/delete/copy'),
        'status' => 1,
        'region' => 'Primary',
        'weight' => 0,
        'visibility' => BLOCK_VISIBILITY_LISTED,
    );

    return $blocks;
}
/*
 * Implements hook_block_view: sets how the block is displayed
 */
function edit_node_block_view($delta = ''){
    switch ($delta) {
        case 'edit_node' :
            $block['subject'] = t('Edit Nodes');
            $block['content'] = drupal_get_form('edit_node_form');
            break;
    }
    return $block;
}
/*
 * implements custom form/creating custom form for drupal_get_form named above.
 */

function edit_node_form($form, &$form_state) {
    $form['node-id'] = array(
        '#type' => 'textfield',
        '#title' => t('Enter the Node ID'),
        '#max-length' => 8,
        '#required' => TRUE,
    );
    $form['edit-node'] = array(
        '#type' => 'radios',
        '#title' => t('Select Action'),
        '#options' => array(t('edit'), t('delete'), t('copy')),
    );
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => t('Submit'),
    );
    return $form;
}

function edit_node_form_validate($form, &$form_state, $node){
    if ($form_state['values']['node-id'] != $node->nid){
        form_set_error('node-id', 'Node-id must match a current nid.');
    }

I see my block in the blocks list. But, my form is not showing up. I am wondering if I need to run a drupal_form_submit('edit_node_form', $form_state); at the end, but shouldn't that be ran during a submit function?

I'm also wondering if I need to update the form_state as I'm not creating a form_id currently (eg https://api.drupal.org/api/drupal/modules!system!system.api.php/function/hook_form_alter/7)

if (isset($form['type']) && $form['type']['#value'] . '_node_settings' == $form_id) {
    $form['workflow']['upload_' . $form['type']['#value']] = array(
      '#type' => 'radios',
      '#title' => t('Attachments'),
      '#default_value' => variable_get('upload_' . $form['type']['#value'], 1),
      '#options' => array(t('Disabled'), t('Enabled')),

But I think that is related to hook_form_alter which I have not called.